-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SPIRV] Support -fembed-bitcode=marker for non-shader modules #162082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2cb721d
806bb39
7e22ddd
5c2271c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||
; RUN: llc -verify-machineinstrs -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, add also a check with spirv-val. Applies to all tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in the latest update. I'll also update the parent PR #162081 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test started failing once I added the spirv-val line. I'm checking this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that I have now more context about all of this. The This is allowed only in amd's flavour but is outside of spirv standard. I think I'm going to change my strategy:
What do you think ? |
||||||
; RUN: %if spirv-tools %{ llc -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
@llvm.embedded.module = private constant [0 x i8] zeroinitializer, section ".llvmbc", align 1 | ||||||
@llvm.cmdline = private constant [5 x i8] c"-cc1\00", section ".llvmcmd", align 1 | ||||||
@llvm.compiler.used = appending global [2 x ptr] [ptr @llvm.embedded.module, ptr @llvm.cmdline], section "llvm.metadata" | ||||||
|
||||||
; CHECK-DAG: OpName [[FOO:%[0-9]+]] "foo" | ||||||
; CHECK-DAG: OpName [[MODULE:%[0-9]+]] "llvm.embedded.module" | ||||||
; CHECK-DAG: [[INT8:%[0-9]+]] = OpTypeInt 8 0 | ||||||
; CHECK-DAG: [[RUNTIME_ARRAY_INT8x1:%[0-9]+]] = OpTypeRuntimeArray [[INT8]] | ||||||
; CHECK-DAG: [[POINTER:%[0-9]+]] = OpTypePointer Function [[RUNTIME_ARRAY_INT8x1]] | ||||||
; CHECK-DAG: [[EMBEDDED_MODULE_INIT:%[0-9]+]] = OpConstantNull [[RUNTIME_ARRAY_INT8x1]] | ||||||
; CHECK: [[FOO]] = OpFunction {{.*}} None {{.*}} | ||||||
; CHECK-DAG: {{%[0-9]+}} = OpVariable [[POINTER]] Function [[EMBEDDED_MODULE_INIT]] | ||||||
|
||||||
define void @foo() #1 { | ||||||
entry: | ||||||
ret void | ||||||
} | ||||||
|
||||||
attributes #1 = { "hlsl.numthreads"="4,8,16" "hlsl.shader"="compute" } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||
|
||
@llvm.embedded.module = private constant [0 x i8] zeroinitializer, section ".llvmbc", align 1 | ||
@llvm.cmdline = private constant [5 x i8] c"-cc1\00", section ".llvmcmd", align 1 | ||
@llvm.compiler.used = appending global [2 x ptr] [ptr @llvm.embedded.module, ptr @llvm.cmdline], section "llvm.metadata" | ||
|
||
; CHECK-DAG: OpName [[FOO:%[0-9]+]] "foo" | ||
; CHECK-DAG: OpName [[MODULE:%[0-9]+]] "llvm.embedded.module" | ||
; CHECK-DAG: [[INT8:%[0-9]+]] = OpTypeInt 8 0 | ||
; CHECK-DAG: [[INT32:%[0-9]+]] = OpTypeInt 32 0 | ||
; CHECK-DAG: [[CONST_1_32:%[0-9]+]] = OpConstant [[INT32]] 1 | ||
; CHECK-DAG: [[ARRAY_INT8x1:%[0-9]+]] = OpTypeArray [[INT8]] [[CONST_1_32]] | ||
; CHECK-DAG: [[POINTER:%[0-9]+]] = OpTypePointer Function [[ARRAY_INT8x1]] | ||
; CHECK-DAG: [[EMBEDDED_MODULE_INIT:%[0-9]+]] = OpConstantNull [[ARRAY_INT8x1]] | ||
; CHECK: [[FOO]] = OpFunction {{.*}} None {{.*}} | ||
; CHECK-DAG: {{%[0-9]+}} = OpVariable [[POINTER]] Function [[EMBEDDED_MODULE_INIT]] | ||
|
||
define spir_kernel void @foo() { | ||
entry: | ||
ret void | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||
|
||
@llvm.embedded.module = private constant [4 x i8] c"BC\C0\DE", section ".llvmbc", align 1 | ||
@llvm.cmdline = private constant [5 x i8] c"-cc1\00", section ".llvmcmd", align 1 | ||
@llvm.compiler.used = appending global [2 x ptr] [ptr @llvm.embedded.module, ptr @llvm.cmdline], section "llvm.metadata" | ||
|
||
; CHECK-DAG: OpName [[FOO:%[0-9]+]] "foo" | ||
; CHECK-DAG: OpName [[MODULE:%[0-9]+]] "llvm.embedded.module" | ||
; CHECK-DAG: [[INT8:%[0-9]+]] = OpTypeInt 8 0 | ||
; CHECK-DAG: [[INT32:%[0-9]+]] = OpTypeInt 32 0 | ||
; CHECK-DAG: [[CONST_4_32:%[0-9]+]] = OpConstant [[INT32]] 4 | ||
; CHECK-DAG: [[ARRAY_INT8x4:%[0-9]+]] = OpTypeArray [[INT8]] [[CONST_4_32]] | ||
; CHECK-DAG: [[POINTER:%[0-9]+]] = OpTypePointer Function [[ARRAY_INT8x4]] | ||
; CHECK-DAG: [[CONST_B_8:%[0-9]+]] = OpConstant [[INT8]] 66 | ||
; CHECK-DAG: [[CONST_C_8:%[0-9]+]] = OpConstant [[INT8]] 67 | ||
; CHECK-DAG: [[CONST_0xC0_8:%[0-9]+]] = OpConstant [[INT8]] 192 | ||
; CHECK-DAG: [[CONST_0xDE_8:%[0-9]+]] = OpConstant [[INT8]] 222 | ||
; CHECK-DAG: [[EMBEDDED_MODULE_INIT:%[0-9]+]] = OpConstantComposite [[ARRAY_INT8x4]] [[CONST_B_8]] [[CONST_C_8]] [[CONST_0xC0_8]] [[CONST_0xDE_8]] | ||
; CHECK: [[FOO]] = OpFunction {{.*}} None {{.*}} | ||
; CHECK-DAG: {{%[0-9]+}} = OpVariable [[POINTER]] Function [[EMBEDDED_MODULE_INIT]] | ||
|
||
define spir_kernel void @foo() { | ||
entry: | ||
ret void | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Markear" (possible typo)