‘hacc’ Dialect¶
Heterogeneous Async Computing Call (HACC) dialect.
Attributes¶
BlockDimAttr¶
Syntax: #hacc.block_dim
HACC block dimension attribute for function.
CachedIOAttr¶
Syntax: #hacc.cached_io
This attribute is used to indicate the value has been cached io.
DummyFuncAttr¶
Syntax: #hacc.dummy_func
HACC dummy func type.
ExportAsDAGAttr¶
Syntax: #hacc.export_as_dag
Export function as DAG.
ExternalFunctionPathAttr¶
Syntax: #hacc.external_function_path
This attribute is used to indicate the location of external functions.
HACCFuncTypeAttr¶
Syntax:
#hacc.function_kind<
::mlir::hacc::HACCFuncType # function_kind
>
HACC function type.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
function_kind |
|
an enum of type HACCFuncType |
GetTilingStructSizeFunctionAttr¶
Syntax:
#hacc.get_tiling_struct_size_function<
::mlir::FlatSymbolRefAttr # funcName
>
HACC get tiling struct size function attribute. This is used to indicate the host get tiling struct size function of the device function.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcName |
|
function symbol name |
HostFuncTypeAttr¶
Syntax:
#hacc.host_func_type<
::mlir::hacc::HostFuncType # host_func_type
>
HACC host func type.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
host_func_type |
|
an enum of type HostFuncType |
InferOutputShapeFunctionAttr¶
Syntax:
#hacc.infer_output_shape_function<
::mlir::FlatSymbolRefAttr # funcName
>
HACC infer output shape function attribute. This is used to indicate the host infer output shape function of the device function.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcName |
|
function symbol name |
InferSyncBlockLockInitFunctionAttr¶
Syntax:
#hacc.infer_sync_block_lock_init_function<
::mlir::FlatSymbolRefAttr # funcName
>
HACC infer sync block lock init function attribute. This is used to indicate the host get sync block lock init value for the device function.
Every lock needs to be initialized before running the kernel, this function is used to infer the initial value of the lock.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcName |
|
function symbol name |
InferSyncBlockLockNumFunctionAttr¶
Syntax:
#hacc.infer_sync_block_lock_num_function<
::mlir::FlatSymbolRefAttr # funcName
>
HACC infer sync block lock num function attribute. This is used to indicate the host infer sync block lock num function of the device function.
For 1 atomic op, all the blocks share 1 <1xi64> type memref on gm, which is called a lock, and this function is used to infer how many locks the kernel needs.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcName |
|
function symbol name |
InferTaskTypeFunctionAttr¶
Syntax:
#hacc.infer_task_type_function<
::mlir::FlatSymbolRefAttr # funcName
>
HACC infer core type and mix ratio.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcName |
|
function symbol name |
InferWorkspaceShapeFunctionAttr¶
Syntax:
#hacc.infer_workspace_shape_function<
::mlir::FlatSymbolRefAttr # funcName
>
HACC infer workspace shape function attribute. This is used to indicate the host infer workspace shape function of the device function.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcName |
|
function symbol name |
InputIdxAttr¶
Syntax:
#hacc.input_idx<
unsigned # argIdx
>
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
argIdx |
|
KernelArgTypeAttr¶
Syntax:
#hacc.arg_type<
::mlir::hacc::KernelArgType # arg_type
>
HACC kernel arg type.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
arg_type |
|
an enum of type KernelArgType |
NoIOAliasAttr¶
Syntax: #hacc.no_io_alias
This attribute is used to indicate the function inputs/outputs are strictly not alias.
OutputIdxAttr¶
Syntax:
#hacc.output_idx<
unsigned # argIdx
>
On NPU device, the kernel function’s calling convention is that the output is passed in as an input parameter.
This attribute is used to indicate which output value does the current function argument corresponds to.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
argIdx |
|
RenameFuncAttr¶
Syntax:
#hacc.rename_func<
::mlir::FlatSymbolRefAttr # targetName
>
This attribute is used to indicate that current function shall be renamed to the target function name.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
targetName |
|
function symbol name |
TargetAttr¶
Syntax:
#hacc.target<
StringAttr # target
>
This attribute is used to indicate the target device.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
target |
|
target device |
TargetDeviceSpecAttr¶
An attribute to represent NPU target device specification.
Syntax:
#hacc.target_device_spec<
::llvm::ArrayRef<DataLayoutEntryInterface> # entries
>
Each device specification describes a single device and its hardware properties. Each device specification can contain any number of optional hardware properties (e.g., “UB_SIZE” below).
Example:
#hacc.target_device_spec<
#dlti.dl_entry<"UB_SIZE", 196608 : i32>>
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
entries |
|
single spec entry |
TilingFunctionAttr¶
Syntax:
#hacc.tiling_function<
::mlir::FlatSymbolRefAttr # funcName
>
HACC tiling function attribute. This is used to indicate the host tiling function of the device function.
Parameters¶
Parameter |
C++ type |
Description |
|---|---|---|
funcName |
|
function symbol name |
Enums¶
DeviceSpec¶
HACC device spec
Cases¶
Symbol |
Value |
String |
|---|---|---|
AI_CORE_COUNT |
|
AI_CORE_COUNT |
CUBE_CORE_COUNT |
|
CUBE_CORE_COUNT |
VECTOR_CORE_COUNT |
|
VECTOR_CORE_COUNT |
UB_SIZE |
|
UB_SIZE |
L1_SIZE |
|
L1_SIZE |
L0A_SIZE |
|
L0A_SIZE |
L0B_SIZE |
|
L0B_SIZE |
L0C_SIZE |
|
L0C_SIZE |
UB_ALIGN_SIZE |
|
UB_ALIGN_SIZE |
L1_ALIGN_SIZE |
|
L1_ALIGN_SIZE |
L0C_ALIGN_SIZE |
|
L0C_ALIGN_SIZE |
HACCFuncType¶
HACC Function Category
Cases¶
Symbol |
Value |
String |
|---|---|---|
HOST |
|
HOST |
DEVICE |
|
DEVICE |
HostFuncType¶
HACC Host function type
Cases¶
Symbol |
Value |
String |
|---|---|---|
kEntry |
|
host_entry |
kTilingFunction |
|
tiling_function |
kInferOutputShapeFunction |
|
infer_output_shape_function |
kInferWorkspaceShapeFunction |
|
infer_workspace_shape_function |
kInferSyncBlockLockNumFunction |
|
infer_sync_block_lock_num_function |
kInferSyncBlockLockInitFunction |
|
infer_sync_block_lock_init_function |
kGetTilingStructSizeFunction |
|
get_tiling_struct_size_function |
kInferTaskTypeFunction |
|
infer_task_type_function |
KernelArgType¶
HACC Kernel Arg Category
Cases¶
Symbol |
Value |
String |
|---|---|---|
kFFTSBaseAddr |
|
ffts_base_address |
kInput |
|
input |
kOutput |
|
output |
kInputAndOutput |
|
input_and_output |
kWorkspace |
|
workspace |
kSyncBlockLock |
|
sync_block_lock |
kTilingKey |
|
tiling_key |
kTilingData |
|
tiling_data |
kTilingStruct |
|
tiling_struct |
kMeshArg |
|
mesh_arg |
kSanitizerAddr |
|
sanitizer_addr |
HACCToLLVMIRTranslateAttr¶
allowed 32-bit signless integer cases: 0, 1, 2
Cases¶
Symbol |
Value |
String |
|---|---|---|
ENTRY |
|
hacc.entry |
MIX_ENTRY |
|
hacc.mix_entry |
ALWAYS_INLINE |
|
hacc.always_inline |