CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
116 lines
3.4 KiB
Python
116 lines
3.4 KiB
Python
# RUN: %PYTHON -m mlir.dialects.linalg.opdsl.dump_oplib --file %s | FileCheck %s
|
|
|
|
from mlir.dialects.linalg.opdsl.lang import *
|
|
|
|
|
|
# CHECK: ---
|
|
# CHECK-LABEL: matmul
|
|
# CHECK: assignments:
|
|
# CHECK: -
|
|
# CHECK: arg: C
|
|
# CHECK: value:
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: binary
|
|
# CHECK: fn_name: add
|
|
# CHECK: operands:
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: binary
|
|
# CHECK: attr_name: mul
|
|
# CHECK: operands:
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: type
|
|
# CHECK: attr_name: cast
|
|
# CHECK: type_var: U
|
|
# CHECK: operands:
|
|
# CHECK: scalar_arg: A
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: type
|
|
# CHECK: attr_name: cast
|
|
# CHECK: type_var: U
|
|
# CHECK: operands:
|
|
# CHECK: scalar_arg: B
|
|
@linalg_structured_op
|
|
def matmul(
|
|
A=TensorDef(T, S.M, S.K),
|
|
B=TensorDef(T, S.K, S.N),
|
|
C=TensorDef(U, S.M, S.N, output=True),
|
|
mul=BinaryFnAttrDef(default=BinaryFn.mul),
|
|
cast=TypeFnAttrDef(default=TypeFn.cast_signed),
|
|
):
|
|
C[D.m, D.n] += mul(cast(U, A[D.m, D.k]), cast(U, B[D.k, D.n]))
|
|
|
|
|
|
# CHECK: ---
|
|
# CHECK-LABEL: constants
|
|
# CHECK: assignments:
|
|
# CHECK: -
|
|
# CHECK: arg: O
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: binary
|
|
# CHECK: fn_name: sub
|
|
# CHECK: operands:
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: binary
|
|
# CHECK: fn_name: add
|
|
# CHECK: operands:
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: unary
|
|
# CHECK: fn_name: exp
|
|
# CHECK: operands:
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: type
|
|
# CHECK: type_var: T
|
|
# CHECK: operands:
|
|
# CHECK: scalar_const: '3.1415926535897931 : f64'
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: type
|
|
# CHECK: fn_name: cast_signed
|
|
# CHECK: type_var: T
|
|
# CHECK: operands:
|
|
# CHECK: scalar_const: '42 : i64'
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: type
|
|
# CHECK: fn_name: cast_signed
|
|
# CHECK: type_var: T
|
|
# CHECK: operands:
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: unary
|
|
# CHECK: attr_name: exp
|
|
# CHECK: operands:
|
|
# CHECK: scalar_const: '1.{{[0]*}}e+03 : f64'
|
|
@linalg_structured_op
|
|
def constants(
|
|
O=TensorDef(T, S.M, S.K, output=True), exp=UnaryFnAttrDef(default=UnaryFn.exp)
|
|
):
|
|
pi = TypeFn.cast_signed(T, const(3.1415926535897931))
|
|
cst42 = TypeFn.cast_signed(T, const(42))
|
|
cst1000 = TypeFn.cast_signed(T, exp(const(1e3)))
|
|
O[D.m, D.n] = UnaryFn.exp(pi) + cst42 - cst1000
|
|
|
|
|
|
# CHECK: ---
|
|
# CHECK-LABEL: indices
|
|
# CHECK: assignments:
|
|
# CHECK: -
|
|
# CHECK: arg: O
|
|
# CHECK: scalar_fn:
|
|
# CHECK: kind: binary
|
|
# CHECK: fn_name: add
|
|
# CHECK: operands:
|
|
# CHECK: scalar_index: 1
|
|
# CHECK: scalar_index: 0
|
|
@linalg_structured_op
|
|
def indices(O=TensorDef(T, S.M, S.K, output=True)):
|
|
O[D.m, D.n] = index(D.n) + index(D.m)
|
|
|
|
|
|
# CHECK: ---
|
|
# CHECK-LABEL: fill
|
|
# CHECK: assignments:
|
|
# CHECK: -
|
|
# CHECK: arg: O
|
|
# CHECK: scalar_arg: value
|
|
@linalg_structured_op
|
|
def fill(value=ScalarDef(T), O=TensorDef(T, S.M, S.K, output=True)):
|
|
O[D.m, D.n] = value
|