Files
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

170 lines
5.0 KiB
MLIR

// RUN: mlir-opt %s --sparse-reinterpret-map -sparsification="parallelization-strategy=none" | \
// RUN: FileCheck %s --check-prefix=CHECK-PAR0
// RUN: mlir-opt %s --sparse-reinterpret-map -sparsification="parallelization-strategy=dense-outer-loop" | \
// RUN: FileCheck %s --check-prefix=CHECK-PAR1
// RUN: mlir-opt %s --sparse-reinterpret-map -sparsification="parallelization-strategy=any-storage-outer-loop" | \
// RUN: FileCheck %s --check-prefix=CHECK-PAR2
// RUN: mlir-opt %s --sparse-reinterpret-map -sparsification="parallelization-strategy=dense-any-loop" | \
// RUN: FileCheck %s --check-prefix=CHECK-PAR3
// RUN: mlir-opt %s --sparse-reinterpret-map -sparsification="parallelization-strategy=any-storage-any-loop" | \
// RUN: FileCheck %s --check-prefix=CHECK-PAR4
#DenseMatrix = #sparse_tensor.encoding<{
map = (d0, d1) -> (d0 : dense, d1 : dense)
}>
#SparseMatrix = #sparse_tensor.encoding<{
map = (d0, d1) -> (d0 : compressed, d1 : compressed)
}>
#CSR = #sparse_tensor.encoding<{
map = (d0, d1) -> (d0 : dense, d1 : compressed)
}>
#trait_dd = {
indexing_maps = [
affine_map<(i,j) -> (i,j)>, // A
affine_map<(i,j) -> (i,j)> // X (out)
],
iterator_types = ["parallel", "parallel"],
doc = "X(i,j) = A(i,j) * SCALE"
}
//
// CHECK-PAR0-LABEL: func @scale_dd
// CHECK-PAR0: scf.for
// CHECK-PAR0: scf.for
// CHECK-PAR0: return
//
// CHECK-PAR1-LABEL: func @scale_dd
// CHECK-PAR1: scf.parallel
// CHECK-PAR1: scf.for
// CHECK-PAR1: return
//
// CHECK-PAR2-LABEL: func @scale_dd
// CHECK-PAR2: scf.parallel
// CHECK-PAR2: scf.for
// CHECK-PAR2: return
//
// CHECK-PAR3-LABEL: func @scale_dd
// CHECK-PAR3: scf.parallel
// CHECK-PAR3: scf.parallel
// CHECK-PAR3: return
//
// CHECK-PAR4-LABEL: func @scale_dd
// CHECK-PAR4: scf.parallel
// CHECK-PAR4: scf.parallel
// CHECK-PAR4: return
//
func.func @scale_dd(%scale: f32,
%arga: tensor<?x?xf32, #DenseMatrix>,
%argx: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic #trait_dd
ins(%arga: tensor<?x?xf32, #DenseMatrix>)
outs(%argx: tensor<?x?xf32>) {
^bb(%a: f32, %x: f32):
%0 = arith.mulf %a, %scale : f32
linalg.yield %0 : f32
} -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
}
#trait_ss = {
indexing_maps = [
affine_map<(i,j) -> (i,j)>, // A
affine_map<(i,j) -> (i,j)> // X (out)
],
iterator_types = ["parallel", "parallel"],
doc = "X(i,j) = A(i,j) * SCALE"
}
//
// CHECK-PAR0-LABEL: func @scale_ss
// CHECK-PAR0: scf.for
// CHECK-PAR0: scf.for
// CHECK-PAR0: return
//
// CHECK-PAR1-LABEL: func @scale_ss
// CHECK-PAR1: scf.for
// CHECK-PAR1: scf.for
// CHECK-PAR1: return
//
// CHECK-PAR2-LABEL: func @scale_ss
// CHECK-PAR2: scf.parallel
// CHECK-PAR2: scf.for
// CHECK-PAR2: return
//
// CHECK-PAR3-LABEL: func @scale_ss
// CHECK-PAR3: scf.for
// CHECK-PAR3: scf.for
// CHECK-PAR3: return
//
// CHECK-PAR4-LABEL: func @scale_ss
// CHECK-PAR4: scf.parallel
// CHECK-PAR4: scf.parallel
// CHECK-PAR4: return
//
func.func @scale_ss(%scale: f32,
%arga: tensor<?x?xf32, #SparseMatrix>,
%argx: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic #trait_ss
ins(%arga: tensor<?x?xf32, #SparseMatrix>)
outs(%argx: tensor<?x?xf32>) {
^bb(%a: f32, %x: f32):
%0 = arith.mulf %a, %scale : f32
linalg.yield %0 : f32
} -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
}
#trait_matvec = {
indexing_maps = [
affine_map<(i,j) -> (i,j)>, // A
affine_map<(i,j) -> (j)>, // b
affine_map<(i,j) -> (i)> // x (out)
],
iterator_types = ["parallel", "reduction"],
doc = "x(i) += A(i,j) * b(j)"
}
//
// CHECK-PAR0-LABEL: func @matvec
// CHECK-PAR0: scf.for
// CHECK-PAR0: scf.for
// CHECK-PAR0: return
//
// CHECK-PAR1-LABEL: func @matvec
// CHECK-PAR1: scf.parallel
// CHECK-PAR1: scf.for
// CHECK-PAR1: return
//
// CHECK-PAR2-LABEL: func @matvec
// CHECK-PAR2: scf.parallel
// CHECK-PAR2: scf.for
// CHECK-PAR2: return
//
// CHECK-PAR3-LABEL: func @matvec
// CHECK-PAR3: scf.parallel
// CHECK-PAR3: scf.for
// CHECK-PAR3: return
//
// CHECK-PAR4-LABEL: func @matvec
// CHECK-PAR4: scf.parallel
// CHECK-PAR4: scf.parallel
// CHECK-PAR4: scf.reduce
// CHECK-PAR4: return
//
func.func @matvec(%arga: tensor<16x32xf32, #CSR>,
%argb: tensor<32xf32>,
%argx: tensor<16xf32>) -> tensor<16xf32> {
%0 = linalg.generic #trait_matvec
ins(%arga, %argb : tensor<16x32xf32, #CSR>, tensor<32xf32>)
outs(%argx: tensor<16xf32>) {
^bb(%A: f32, %b: f32, %x: f32):
%0 = arith.mulf %A, %b : f32
%1 = arith.addf %0, %x : f32
linalg.yield %1 : f32
} -> tensor<16xf32>
return %0 : tensor<16xf32>
}