Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[LLVM] Fix compat with upstream LLVM #1003

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

Merged
merged 6 commits into from
Apr 27, 2023

Conversation

fodinabor
Copy link
Collaborator

This fixes a few API / header incompatibilitíes introduced in upstream LLVM.

However, building the tests targeting SSCP is currently still crashing the compiler:
https://github.com/fodinabor/hipSYCL-LLVM-upstream-ci/actions/runs/4618580379/jobs/8166214068#step:11:46
Didn't investigate that too much.
Maybe @illuhad has an intuition about what might go wrong there?

#1000

@illuhad
Copy link
Collaborator

illuhad commented Apr 5, 2023

hm.. not really. We'd need to look at the IR it's actually generating. Maybe it's related to opaque pointers or something like that.

@illuhad
Copy link
Collaborator

illuhad commented Apr 5, 2023

nvc++ is also failing.

@fodinabor
Copy link
Collaborator Author

Re SSCP failing with LLVM 17: one assert is triggered upon setting the dummy int value as content: https://github.com/OpenSYCL/OpenSYCL/blob/7cff8d4b8ca5d818d67b6fc6a23b9f14b1302e01/src/compiler/sscp/TargetSeparationPass.cpp#L260
Upon removing that, debug-built LLVM is able to compile device_compilation_tests but then the S2 fails..
Also, LLVM in Release mode still crashes in S1.. :/

--- a/src/compiler/sscp/TargetSeparationPass.cpp
+++ b/src/compiler/sscp/TargetSeparationPass.cpp
@@ -257,7 +257,7 @@ std::unique_ptr<llvm::Module> generateDeviceIR(llvm::Module &M,
   // SscpIsHostIdentifier can also be used in device code.
   S1IRConstantReplacer DeviceSideReplacer{
       {{SscpIsHostIdentifier, 0}, {SscpIsDeviceIdentifier, 1}},
-      {{SscpHcfContentIdentifier, 0 /* Dummy value */}, {SscpHcfObjectSizeIdentifier, 0}},
+      {{SscpHcfObjectSizeIdentifier, 0}},
       {{SscpHcfContentIdentifier, std::string{}}}};
   DeviceSideReplacer.run(*DeviceModule, DeviceMAM);

S2 failure, this branch: An assertion is triggered, since the GV _ZTVN10__cxxabiv120__si_class_type_infoE.original has no initializer.

S2 failure after applying #1020 to this branch:

[hipSYCL Error] from /home/joachimm/Projekte/opensycl/include/hipSYCL/glue/llvm-sscp/jit.hpp:251 @ compile(): jit::compile: Encountered errors:
0: LLVMToAmdgpu: hiprtcLinkComplete() failed

Thx HIP ^^

@illuhad
Copy link
Collaborator

illuhad commented Apr 26, 2023

Thanks for digging into this... We should probably explicitly cast the 0 values to the actual type that it uses. I think it's size_t. Currently installing LLVM 17, maybe I can fix the issues :)

@fodinabor
Copy link
Collaborator Author

well, SscpHcfContentIdentifier really should never get an int as value but an empty string only, right?

@illuhad
Copy link
Collaborator

illuhad commented Apr 26, 2023

Yes, the initialization with 0 is clearly wrong, and probably an oversight since it's followed by initalization with empty string. I'm just concerned whether the other variables might be problematic too since the code might try to initialize them as int when actually they (or some of them) are size_t due to the type of the 0 literal.

EDIT: The different arguments of the replacer are differently typed, so the arguments should already correctly take into account the difference between int and uint64 arguments.

@illuhad
Copy link
Collaborator

illuhad commented Apr 26, 2023

This commit:
llvm/llvm-project@ae77ace
has removed SyncDependenceAnalysis.h, so for really current LLVM 17 distributions, another workaround is required :(

@illuhad illuhad merged commit bb032e6 into AdaptiveCpp:develop Apr 27, 2023
@fodinabor fodinabor deleted the bugfix/llvm-17 branch April 27, 2023 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants