Files
TheRock/compiler/amd-llvm/mlir/test/Target/SPIRV/ocl-ops.mlir
T
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

102 lines
4.4 KiB
MLIR

// RUN: mlir-translate -no-implicit-module -test-spirv-roundtrip %s | FileCheck %s
// RUN: %if spirv-tools %{ rm -rf %t %}
// RUN: %if spirv-tools %{ mkdir %t %}
// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %}
// RUN: %if spirv-tools %{ spirv-val %t %}
spirv.module Physical64 OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses, Vector16, Linkage], []> {
spirv.func @float_insts(%arg0 : f32) "None" {
// CHECK: {{%.*}} = spirv.CL.exp {{%.*}} : f32
%0 = spirv.CL.exp %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.fabs {{%.*}} : f32
%1 = spirv.CL.fabs %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.sin {{%.*}} : f32
%2 = spirv.CL.sin %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.cos {{%.*}} : f32
%3 = spirv.CL.cos %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.log {{%.*}} : f32
%4 = spirv.CL.log %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.exp2 {{%.*}} : f32
%exp2 = spirv.CL.exp2 %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.exp10 {{%.*}} : f32
%exp10 = spirv.CL.exp10 %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.log2 {{%.*}} : f32
%log2 = spirv.CL.log2 %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.log10 {{%.*}} : f32
%log10 = spirv.CL.log10 %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.sqrt {{%.*}} : f32
%5 = spirv.CL.sqrt %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.ceil {{%.*}} : f32
%6 = spirv.CL.ceil %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.floor {{%.*}} : f32
%7 = spirv.CL.floor %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.pow {{%.*}}, {{%.*}} : f32
%8 = spirv.CL.pow %arg0, %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.rsqrt {{%.*}} : f32
%9 = spirv.CL.rsqrt %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.erf {{%.*}} : f32
%10 = spirv.CL.erf %arg0 : f32
// CHECK: {{%.*}} = spirv.CL.trunc {{%.*}} : f32
%11 = spirv.CL.trunc %arg0 : f32
spirv.Return
}
spirv.func @integer_insts(%arg0 : i32) "None" {
// CHECK: {{%.*}} = spirv.CL.s_abs {{%.*}} : i32
%0 = spirv.CL.s_abs %arg0 : i32
// CHECK: {{%.*}} = spirv.CL.clz {{%.*}} : i32
%1 = spirv.CL.clz %arg0 : i32
spirv.Return
}
spirv.func @vector_size16(%arg0 : vector<16xf32>) "None" {
// CHECK: {{%.*}} = spirv.CL.fabs {{%.*}} : vector<16xf32>
%0 = spirv.CL.fabs %arg0 : vector<16xf32>
spirv.Return
}
spirv.func @fma(%arg0 : f32, %arg1 : f32, %arg2 : f32) "None" {
// CHECK: spirv.CL.fma {{%[^,]*}}, {{%[^,]*}}, {{%[^,]*}} : f32
%13 = spirv.CL.fma %arg0, %arg1, %arg2 : f32
spirv.Return
}
spirv.func @float_int_insts(%arg0 : f32, %arg1 : i32) "None" {
// CHECK: {{%.*}} = spirv.CL.ldexp {{%.*}}, {{%.*}} : f32, i32 -> f32
%0 = spirv.CL.ldexp %arg0, %arg1 : f32, i32 -> f32
// CHECK: {{%.*}} = spirv.CL.pown {{%.*}}, {{%.*}} : f32, i32 -> f32
%1 = spirv.CL.pown %arg0, %arg1 : f32, i32 -> f32
// CHECK: {{%.*}} = spirv.CL.rootn {{%.*}}, {{%.*}} : f32, i32 -> f32
%2 = spirv.CL.rootn %arg0, %arg1 : f32, i32 -> f32
spirv.Return
}
spirv.func @float_int_vec_insts(%arg0 : vector<3xf32>, %arg1 : vector<3xi32>) "None" {
// CHECK: {{%.*}} = spirv.CL.ldexp {{%.*}}, {{%.*}} : vector<3xf32>, vector<3xi32> -> vector<3xf32>
%0 = spirv.CL.ldexp %arg0, %arg1 : vector<3xf32>, vector<3xi32> -> vector<3xf32>
// CHECK: {{%.*}} = spirv.CL.pown {{%.*}}, {{%.*}} : vector<3xf32>, vector<3xi32> -> vector<3xf32>
%1 = spirv.CL.pown %arg0, %arg1 : vector<3xf32>, vector<3xi32> -> vector<3xf32>
// CHECK: {{%.*}} = spirv.CL.rootn {{%.*}}, {{%.*}} : vector<3xf32>, vector<3xi32> -> vector<3xf32>
%2 = spirv.CL.rootn %arg0, %arg1 : vector<3xf32>, vector<3xi32> -> vector<3xf32>
spirv.Return
}
spirv.func @maxmin(%arg0 : f32, %arg1 : f32, %arg2 : i32, %arg3 : i32) "None" {
// CHECK: {{%.*}} = spirv.CL.fmax {{%.*}}, {{%.*}} : f32
%1 = spirv.CL.fmax %arg0, %arg1 : f32
// CHECK: {{%.*}} = spirv.CL.s_max {{%.*}}, {{%.*}} : i32
%2 = spirv.CL.s_max %arg2, %arg3 : i32
// CHECK: {{%.*}} = spirv.CL.u_max {{%.*}}, {{%.*}} : i32
%3 = spirv.CL.u_max %arg2, %arg3 : i32
// CHECK: {{%.*}} = spirv.CL.fmin {{%.*}}, {{%.*}} : f32
%4 = spirv.CL.fmin %arg0, %arg1 : f32
// CHECK: {{%.*}} = spirv.CL.s_min {{%.*}}, {{%.*}} : i32
%5 = spirv.CL.s_min %arg2, %arg3 : i32
// CHECK: {{%.*}} = spirv.CL.u_min {{%.*}}, {{%.*}} : i32
%6 = spirv.CL.u_min %arg2, %arg3 : i32
spirv.Return
}
}