Skip to content
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

[clang][SPIR-V] Set AS for the SPIR-V logical triple #88939

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

bogner
Copy link
Contributor

@bogner bogner commented Apr 16, 2024

This was missed in #88455, causing most of the .hlsl to SPIR-V tests to fail (such as clang\test\Driver\hlsl-lang-targets-spirv.hlsl)

This was missed in llvm#88455, causing most of the .hlsl to SPIR-V tests
to fail (such as clang\test\Driver\hlsl-lang-targets-spirv.hlsl)
@bogner bogner requested review from Keenuts and AlexVlx April 16, 2024 17:29
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Apr 16, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 16, 2024

@llvm/pr-subscribers-clang

Author: Justin Bogner (bogner)

Changes

This was missed in #88455, causing most of the .hlsl to SPIR-V tests to fail (such as clang\test\Driver\hlsl-lang-targets-spirv.hlsl)


Full diff: https://github.com/llvm/llvm-project/pull/88939.diff

1 Files Affected:

  • (modified) clang/lib/Basic/Targets/SPIR.h (+1-1)
diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
index 9a4a8b501460b6..44265445ff004b 100644
--- a/clang/lib/Basic/Targets/SPIR.h
+++ b/clang/lib/Basic/Targets/SPIR.h
@@ -315,7 +315,7 @@ class LLVM_LIBRARY_VISIBILITY SPIRVTargetInfo : public BaseSPIRVTargetInfo {
     // SPIR-V IDs are represented with a single 32-bit word.
     SizeType = TargetInfo::UnsignedInt;
     resetDataLayout("e-i64:64-v16:16-v24:32-v32:32-v48:64-"
-                    "v96:128-v192:256-v256:256-v512:512-v1024:1024");
+                    "v96:128-v192:256-v256:256-v512:512-v1024:1024-G1");
   }
 
   void getTargetDefines(const LangOptions &Opts,

Copy link
Contributor

@Keenuts Keenuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@AlexVlx
Copy link
Contributor

AlexVlx commented Apr 16, 2024

a) Thanks!; b) apologies for the noise; c) this was actually done on purpose, I actively eschewed changing Logical SPIRV because it wasn't actually clear to me if in the long run it'd have the same AS map / would use numerical 1 for globals. If Logical SPIRV is going to go with numerical 1 for globals, LGTM (perhaps it's worth reflecting that in AutoUpgrade.cpp & associated tests, wherein the predicate guards autoupgrades from occuring on Logical SPIRV)!

As a sidenote, as far as I can tell, this flared up because in LLVM's SPIRV TargetMachine there's no segregation between Logical & Physical SPIRV. Would it be worthwhile to add that?

Copy link
Contributor

@AlexVlx AlexVlx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please have a peek at the comment if possible.

@bogner
Copy link
Contributor Author

bogner commented Apr 16, 2024

a) Thanks!; b) apologies for the noise; c) this was actually done on purpose, I actively eschewed changing Logical SPIRV because it wasn't actually clear to me if in the long run it'd have the same AS map / would use numerical 1 for globals. If Logical SPIRV is going to go with numerical 1 for globals, LGTM (perhaps it's worth reflecting that in AutoUpgrade.cpp & associated tests, wherein the predicate guards autoupgrades from occuring on Logical SPIRV)!

As a sidenote, as far as I can tell, this flared up because in LLVM's SPIRV TargetMachine there's no segregation between Logical & Physical SPIRV. Would it be worthwhile to add that?

@Keenuts Do you have thoughts here? I'm not sure there's been much discussion around this.

I'm going to go ahead and push this as is to get the tests passing and we should follow up as necessary.

@bogner bogner merged commit b0ddbfb into llvm:main Apr 16, 2024
6 of 7 checks passed
Copy link
Contributor

@coopp coopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@Keenuts
Copy link
Contributor

Keenuts commented Apr 17, 2024

Thanks all!
Agree with Bogner, let's unblock the tests first.
As for the address space for globals, this isn't something we have looked into yet, so I'd be in favor of keeping the same behavior as the SPIRN flavor until we have a reason to diverge (as in "thought about this issue" 😊)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SPIR-V] error: backend data layout does not match expected target description
5 participants