| 1 |
; This tests checks if FP8 matrix conversions work fine. |
| 2 |
|
| 3 |
; RUN: llvm-as %s -o %t.bc |
| 4 |
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_EXT_float8,+SPV_KHR_cooperative_matrix |
| 5 |
; RUN: llvm-spirv %t.spv -o %t.spt --to-text |
| 6 |
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV |
| 7 |
; RUN: llvm-spirv %t.spv -o %t.rev.bc -r --spirv-target-env=SPV-IR |
| 8 |
; RUN: llvm-dis %t.rev.bc -o %t.rev.ll |
| 9 |
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM |
| 10 |
|
| 11 |
; TODO: RUNx: spirv-val |
| 12 |
|
| 13 |
; CHECK-SPIRV-DAG: CooperativeMatrixKHR |
| 14 |
; CHECK-SPIRV-DAG: Float8EXT |
| 15 |
; CHECK-SPIRV-DAG: Float8CooperativeMatrixEXT |
| 16 |
; CHECK-SPIRV-DAG: "SPV_EXT_float8" |
| 17 |
; CHECK-SPIRV-DAG: "SPV_KHR_cooperative_matrix" |
| 18 |
|
| 19 |
; CHECK-SPIRV-DAG: TypeInt [[#Int8Ty:]] 8 0 |
| 20 |
; CHECK-SPIRV-DAG: TypeFloat [[#FP8Ty:]] 8 4214 |
| 21 |
; CHECK-SPIRV-DAG: TypeFloat [[#FP16Ty:]] 16 |
| 22 |
; CHECK-SPIRV-DAG: TypeCooperativeMatrixKHR [[#Int8MatrixTy:]] [[#Int8Ty]] |
| 23 |
; CHECK-SPIRV-DAG: TypeCooperativeMatrixKHR [[#FP8MatrixTy:]] [[#FP8Ty]] |
| 24 |
; CHECK-SPIRV-DAG: TypeCooperativeMatrixKHR [[#FP16MatrixTy:]] [[#FP16Ty]] |
| 25 |
|
| 26 |
; CHECK-SPIRV: CompositeConstruct [[#FP16MatrixTy]] [[#M:]] [[#]] |
| 27 |
; CHECK-SPIRV: FConvert [[#FP8MatrixTy]] [[#Conv:]] [[#M]] |
| 28 |
; CHECK-SPIRV: Bitcast [[#Int8MatrixTy]] [[#]] [[#Conv]] |
| 29 |
|
| 30 |
; CHECK-LLVM: %[[#M:]] = call spir_func target("spirv.CooperativeMatrixKHR", half, 3, 12, 12, 2) @_Z26__spirv_CompositeConstructDh(half 0xH0000) |
| 31 |
; CHECK-LLVM: call target("spirv.CooperativeMatrixKHR", i8, 3, 12, 12, 2) @_Z36__builtin_spirv_ConvertFP16ToE4M3EXTPU3AS144__spirv_CooperativeMatrixKHR__half_3_12_12_2(target("spirv.CooperativeMatrixKHR", half, 3, 12, 12, 2) %[[#M]]) |
| 32 |
|
| 33 |
; ModuleID = 'test.bc' |
| 34 |
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-G1" |
| 35 |
target triple = "spir-unknown-unknown" |
| 36 |
|
| 37 |
; Function Attrs: nounwind |
| 38 |
define spir_func void @int4_hf8() #0 { |
| 39 |
entry: |
| 40 |
%0 = call spir_func target("spirv.CooperativeMatrixKHR", half, 3, 12, 12, 2) @_Z26__spirv_CompositeConstructDh(half 0.0) #0 |
| 41 |
%1 = call target("spirv.CooperativeMatrixKHR", i8, 3, 12, 12, 2) @_Z36__builtin_spirv_ConvertFP16ToE4M3EXTPU3AS144__spirv_CooperativeMatrixKHR__half_3_12_12_2(target("spirv.CooperativeMatrixKHR", half, 3, 12, 12, 2) %0) |
| 42 |
ret void |
| 43 |
} |
| 44 |
|
| 45 |
; Function Attrs: nounwind |
| 46 |
declare spir_func target("spirv.CooperativeMatrixKHR", half, 3, 12, 12, 2) @_Z26__spirv_CompositeConstructDh(half) #0 |
| 47 |
|
| 48 |
declare target("spirv.CooperativeMatrixKHR", i8, 3, 12, 12, 2) @_Z36__builtin_spirv_ConvertFP16ToE4M3EXTPU3AS144__spirv_CooperativeMatrixKHR__half_3_12_12_2(target("spirv.CooperativeMatrixKHR", half, 3, 12, 12, 2)) |
| 49 |
|
| 50 |
attributes #0 = { nounwind } |
| 51 |
|
| 52 |
!spirv.MemoryModel = !{!0} |
| 53 |
!opencl.enable.FP_CONTRACT = !{} |
| 54 |
!spirv.Source = !{!1} |
| 55 |
!opencl.spir.version = !{!0} |
| 56 |
!opencl.used.extensions = !{!2} |
| 57 |
!opencl.used.optional.core.features = !{!2} |
| 58 |
!spirv.Generator = !{!3} |
| 59 |
|
| 60 |
!0 = !{i32 1, i32 2} |
| 61 |
!1 = !{i32 0, i32 0} |
| 62 |
!2 = !{} |
| 63 |
!3 = !{i16 6, i16 14} |