
- Redefines `DXILAttribute` to denote a function attribute, compatible to how it was define in DXC/LLVM 3.7 - Fix how `DXILAttribute` is emitted to be a struct of set attributes instead of an "or" of the enums - Implement the lowering of `DXILAttribute` to LLVM function attributes in `DXILOpBuilder.cpp`. A custom mapping is defined. - Audit all current ops to specify the correct attributes consistent with DXC. This is done here to allow for testing. - Update testcases in `llvm/test/CodeGen/DirectX` of all ops with attributes to match that attributes are set - Update testcases of ops that had previously incorrectly set attributes to check there is no attributes set - Defines `DXILProperty` to denote the other type of attributes from DXC used to query properties. - Emit `DXILProperty` as a struct of set attributes. - Updates `DXIL.td` to specify applicable `DXILProperty`s on ops Note: `DXILProperty` was referred to as 'queryable attributes' in design discussion. Changed to property to allow for better expression in `DXIL.td` Resolves #114461 Resolves #115912
54 lines
1.7 KiB
LLVM
54 lines
1.7 KiB
LLVM
; RUN: opt -S -dxil-op-lower %s | FileCheck %s
|
|
|
|
; Make sure dxil operation function calls for all ComputeID dxil operations are generated.
|
|
|
|
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
|
|
target triple = "dxil-pc-shadermodel6.7-compute"
|
|
|
|
; CHECK-LABEL: @test_thread_id(
|
|
; Function Attrs: noinline nounwind optnone
|
|
define i32 @test_thread_id(i32 %a) #0 {
|
|
entry:
|
|
; CHECK:call i32 @dx.op.threadId.i32(i32 93, i32 %{{.*}}) #[[#ATTR:]]
|
|
%0 = call i32 @llvm.dx.thread.id(i32 %a)
|
|
ret i32 %0
|
|
}
|
|
|
|
; CHECK-LABEL: @test_group_id(
|
|
; Function Attrs: noinline nounwind optnone
|
|
define i32 @test_group_id(i32 %a) #0 {
|
|
entry:
|
|
; CHECK: call i32 @dx.op.groupId.i32(i32 94, i32 %{{.*}}) #[[#ATTR]]
|
|
%0 = call i32 @llvm.dx.group.id(i32 %a)
|
|
ret i32 %0
|
|
}
|
|
|
|
; CHECK-LABEL: @test_thread_id_in_group(
|
|
; Function Attrs: noinline nounwind optnone
|
|
define i32 @test_thread_id_in_group(i32 %a) #0 {
|
|
entry:
|
|
; CHECK: call i32 @dx.op.threadIdInGroup.i32(i32 95, i32 %{{.*}}) #[[#ATTR]]
|
|
%0 = call i32 @llvm.dx.thread.id.in.group(i32 %a)
|
|
ret i32 %0
|
|
}
|
|
|
|
; CHECK-LABEL: @test_flattened_thread_id_in_group(
|
|
; Function Attrs: noinline nounwind optnone
|
|
define i32 @test_flattened_thread_id_in_group() #0 {
|
|
entry:
|
|
; CHECK: call i32 @dx.op.flattenedThreadIdInGroup.i32(i32 96) #[[#ATTR]]
|
|
%0 = call i32 @llvm.dx.flattened.thread.id.in.group()
|
|
ret i32 %0
|
|
}
|
|
|
|
; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
|
|
|
|
; Function Attrs: nounwind readnone willreturn
|
|
declare i32 @llvm.dx.thread.id(i32) #1
|
|
declare i32 @llvm.dx.group.id(i32) #1
|
|
declare i32 @llvm.dx.flattened.thread.id.in.group() #1
|
|
declare i32 @llvm.dx.thread.id.in.group(i32) #1
|
|
|
|
attributes #0 = { noinline nounwind }
|
|
attributes #1 = { nounwind readnone willreturn }
|