Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/clang/lib/SPIRV/SpirvEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2021,6 +2021,10 @@ void SpirvEmitter::doVarDecl(const VarDecl *decl) {
// variables) belongs to the Function storage class.
if (isExternalVar(decl)) {
var = declIdMapper.createExternVar(decl);
if (decl->hasInit()) {
emitWarning("Initializer of external global will be ignored",
decl->getLocation());
}
} else {
// We already know the variable is not externally visible here. If it does
// not have local storage, it should be file scope variable.
Expand Down
19 changes: 19 additions & 0 deletions tools/clang/test/CodeGenSPIRV/groupshared.init.warning.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: %dxc -T cs_6_0 -E main -spirv %s 2>&1 | FileCheck %s

groupshared uint testing = 0;

[numthreads(64, 1, 1)]
void main(uint local_thread_id_flat : SV_GroupIndex) {

InterlockedAdd(testing, 1);
GroupMemoryBarrierWithGroupSync();

if (local_thread_id_flat == 0) {
if (testing > 64) {
printf("testing is %u wtf", testing);
}
}
}

// CHECK: warning: Initializer of external global will be ignored
// CHECK-NEXT: groupshared uint testing = 0;