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
91 lines
2.9 KiB
Python
91 lines
2.9 KiB
Python
# RUN: %PYTHON %s | FileCheck %s
|
|
|
|
from mlir.ir import *
|
|
import mlir.dialects.builtin as builtin
|
|
import mlir.dialects.func as func
|
|
import mlir.dialects.vector as vector
|
|
|
|
|
|
def run(f):
|
|
print("\nTEST:", f.__name__)
|
|
with Context(), Location.unknown():
|
|
f()
|
|
return f
|
|
|
|
|
|
# CHECK-LABEL: TEST: testPrintOp
|
|
@run
|
|
def testPrintOp():
|
|
module = Module.create()
|
|
with InsertionPoint(module.body):
|
|
|
|
@func.FuncOp.from_py_func(VectorType.get((12, 5), F32Type.get()))
|
|
def print_vector(arg):
|
|
return vector.PrintOp(source=arg)
|
|
|
|
# CHECK-LABEL: func @print_vector(
|
|
# CHECK-SAME: %[[ARG:.*]]: vector<12x5xf32>) {
|
|
# CHECK: vector.print %[[ARG]] : vector<12x5xf32>
|
|
# CHECK: return
|
|
# CHECK: }
|
|
print(module)
|
|
|
|
|
|
# CHECK-LABEL: TEST: testTransferReadOp
|
|
@run
|
|
def testTransferReadOp():
|
|
module = Module.create()
|
|
with InsertionPoint(module.body):
|
|
vector_type = VectorType.get([2, 3], F32Type.get())
|
|
memref_type = MemRefType.get(
|
|
[ShapedType.get_dynamic_size(), ShapedType.get_dynamic_size()],
|
|
F32Type.get(),
|
|
)
|
|
index_type = IndexType.get()
|
|
mask_type = VectorType.get(vector_type.shape, IntegerType.get_signless(1))
|
|
identity_map = AffineMap.get_identity(vector_type.rank)
|
|
identity_map_attr = AffineMapAttr.get(identity_map)
|
|
f = func.FuncOp(
|
|
"transfer_read", ([memref_type, index_type, F32Type.get(), mask_type], [])
|
|
)
|
|
with InsertionPoint(f.add_entry_block()):
|
|
A, zero, padding, mask = f.arguments
|
|
vector.TransferReadOp(
|
|
vector_type,
|
|
A,
|
|
[zero, zero],
|
|
identity_map_attr,
|
|
padding,
|
|
[False, False],
|
|
mask=mask,
|
|
)
|
|
vector.TransferReadOp(
|
|
vector_type, A, [zero, zero], identity_map_attr, padding, [False, False]
|
|
)
|
|
func.ReturnOp([])
|
|
|
|
# CHECK: @transfer_read(%[[MEM:.*]]: memref<?x?xf32>, %[[IDX:.*]]: index,
|
|
# CHECK: %[[PAD:.*]]: f32, %[[MASK:.*]]: vector<2x3xi1>)
|
|
# CHECK: vector.transfer_read %[[MEM]][%[[IDX]], %[[IDX]]], %[[PAD]], %[[MASK]]
|
|
# CHECK: vector.transfer_read %[[MEM]][%[[IDX]], %[[IDX]]], %[[PAD]]
|
|
# CHECK-NOT: %[[MASK]]
|
|
print(module)
|
|
|
|
|
|
# CHECK-LABEL: TEST: testBitEnumCombiningKind
|
|
@run
|
|
def testBitEnumCombiningKind():
|
|
module = Module.create()
|
|
with InsertionPoint(module.body):
|
|
f32 = F32Type.get()
|
|
vector_type = VectorType.get([16], f32)
|
|
|
|
@func.FuncOp.from_py_func(vector_type)
|
|
def reduction(arg):
|
|
v = vector.ReductionOp(f32, vector.CombiningKind.ADD, arg)
|
|
return v
|
|
|
|
# CHECK: func.func @reduction(%[[VEC:.*]]: vector<16xf32>) -> f32 {
|
|
# CHECK: %0 = vector.reduction <add>, %[[VEC]] : vector<16xf32> into f32
|
|
print(module)
|