pub struct SparseMFMAOperation<'c> { /* private fields */ }Expand description
A sparse_mfma operation. MLIR wrapper for CDNA sparse mfma (smfmac) instructions.
The amdgpu.sparse_mfma op is an MLIR wrapper around intrinsics for various
smfmac instructions in the AMDGPU architecture, which perform matrix
multiply-accumulate operations using 2:4 structured sparsity on matrix A
with dense matrices B, C, and D.
On gfx942, smfmac intrinsics support:
- M=N=16, K=32 and M=N=32, K=16 for f16 and bf16 sources
- M=N=16, K=64 and M=N=32, K=32 for i8 and fp8 sources
On gfx950, smfmac intrinsics additionally support:
- M=N=16, K=64 and M=N=32, K=32 for f16 and bf16 sources
- M=N=16, K=128 and M=N=32, K=64 for i8 and fp8 sources
The sparseIdx parameter contains packed indices identifying the positions
of non-zero elements in the 2:4 sparse matrix A. For 16-bit source data,
use vector<4xi8> (four 8-bit indices). For 8-bit source data, use
vector<2xi16> (two 16-bit indices).
The cbsz and abid parameters are repurposed to select the index set.
If cbsz == 0, then abid[1:0] selects which index set to use.
If cbsz != 0, then the very first is selected.
Example:
%0 = amdgpu.sparse_mfma 16x16x32 %matA * %matB + %matC sparse(%idx : vector<4xi8>)
: vector<4xf16>, vector<8xf16>, vector<4xf32>
%1 = amdgpu.sparse_mfma 16x16x64 %matA * %matB + %matC sparse(%idx : vector<2xi16>)
: vector<8xi8>, vector<16xi8>, vector<4xi32>
%2 = amdgpu.sparse_mfma 16x16x64 %matA * %matB + %matC sparse(%idx : vector<2xi16>)
{ cbsz = 0 : i32, abid = 1 : i32 }
: vector<8xf8E4M3FNUZ>, vector<16xf8E4M3FNUZ>, vector<4xf32>Implementations§
Source§impl<'c> SparseMFMAOperation<'c>
impl<'c> SparseMFMAOperation<'c>
Sourcepub fn as_operation(&self) -> &Operation<'c>
pub fn as_operation(&self) -> &Operation<'c>
Returns a generic operation.
Sourcepub fn builder(
context: &'c Context,
location: Location<'c>,
) -> SparseMFMAOperationBuilder<'c, Unset, Unset, Unset, Unset, Unset, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c>, ) -> SparseMFMAOperationBuilder<'c, Unset, Unset, Unset, Unset, Unset, Unset, Unset, Unset>
Creates a builder.
pub fn dest_d(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn source_a(&self) -> Result<Value<'c, '_>, Error>
pub fn source_b(&self) -> Result<Value<'c, '_>, Error>
pub fn dest_c(&self) -> Result<Value<'c, '_>, Error>
pub fn sparse_idx(&self) -> Result<Value<'c, '_>, Error>
pub fn m(&self) -> Result<IntegerAttribute<'c>, Error>
pub fn set_m(&mut self, value: IntegerAttribute<'c>)
pub fn n(&self) -> Result<IntegerAttribute<'c>, Error>
pub fn set_n(&mut self, value: IntegerAttribute<'c>)
pub fn k(&self) -> Result<IntegerAttribute<'c>, Error>
pub fn set_k(&mut self, value: IntegerAttribute<'c>)
pub fn cbsz(&self) -> Result<IntegerAttribute<'c>, Error>
pub fn set_cbsz(&mut self, value: IntegerAttribute<'c>)
pub fn remove_cbsz(&mut self) -> Result<(), Error>
pub fn abid(&self) -> Result<IntegerAttribute<'c>, Error>
pub fn set_abid(&mut self, value: IntegerAttribute<'c>)
pub fn remove_abid(&mut self) -> Result<(), Error>
Trait Implementations§
Source§impl<'c> Clone for SparseMFMAOperation<'c>
impl<'c> Clone for SparseMFMAOperation<'c>
Source§fn clone(&self) -> SparseMFMAOperation<'c>
fn clone(&self) -> SparseMFMAOperation<'c>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more