-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][libclc] Remangler tool for consistent mangling #4207
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
Conversation
Libclc mangling is either done manually or done based on the function signatures if requested. However, since libclc uses OpenCL C, the primitive types are of set sizes and signedness, eg. long must be 64 bits and char must be signed. When a target disagrees on primitive types it may use incompatible libclc functions due to inconsistent mangling between libclc and the target. This commit adds a tool for remangling libclc bitcode files such that the mangled names match the primitive types for the target. Additionally it creates aliases where appropriate, eg. if long is 32 bits on the target a function using long will have its mangling changed to appear as if it is using long long instead, and the old mangling will be made an alias to an existing 32-bit integer version of the function if such a function exists. Signed-off-by: Steffen Larsen <[email protected]>
Signed-off-by: Steffen Larsen <[email protected]>
/summary:run |
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.
FE changes look ok to me but @AaronBallman @premanandrao, can one of you take a look as well? I'm not very familiar with this
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.
Temporarily approving for triggering Github checks. Will revoke the approval after that.
Revoke the approval, checks were started.
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.
sycl/include/CL/__spirv/spirv_ops.hpp
LGTM
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.
I have no issues with this, just a minor nit with a diagnostic quoting.
Signed-off-by: Steffen Larsen <[email protected]>
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.
FE bits LGTM!
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.
LGTM, just a few minor comments.
Signed-off-by: Steffen Larsen <[email protected]>
@mdtoguchi, @AGindinson, ping. |
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.
The Driver part looks good in the context of the change.
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.
sycl/include/CL/__spirv/spirv_ops.hpp
LGTM
73b844e
fb5cc9f
to
e8171e6
Compare
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.
sycl/include/CL/__spirv/spirv_ops.hpp
LGTM
The introduction of this PR has a lot of information that should be present somewhere as comments in the code or is the design documentation, if it is not done already. |
The PR introduction information has not been commented or added into the design docs within this PR. I could do a separate PR adding to the design docs and commenting the relevant portions with the details in the intro. Would this work for you? |
LibclcRemangler.cpp has a description early in the file to document the purpose of the tool, similar to the PR introduction. That said, if there is a suitable place to give a quick summary and refer to it I agree that it would be a good idea to do so. It is a bit of a shadow agent tool. |
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.
FE changes LGTM
Signed-off-by: Steffen Larsen <[email protected]>
…4348) Remangler tool introduced with #4207 also included simplifications to the use of `signed char` in libclc. These simplifications changed the generated SPIRV builtins in a way that causes previously passing CTS tests to fail. This PR reverts the `signed char` simplifications, preserving the remangler and the `long` simplifications. Signed-off-by: Steffen Larsen <[email protected]>
Patch adds windows support for CUDA backend. Adds general handling of Windows file paths Windows support is enabled with remangling of variables from PR #4207 as it fixes mismatch between windows 32-bit longs and default 64-bit long and handles wchar_size. Adds changes to account for MSVC's default to private classes. Fixes to unittests for windows. Signed-off-by: Steffen Larsen <[email protected]>
Libclc mangling is either done manually or done based on the function signatures if requested. However, since libclc uses OpenCL C, the primitive types are of set sizes and signedness, eg.
long
must be 64 bits andchar
must be signed.When a target disagrees on primitive types it may use incompatible libclc functions due to inconsistent mangling between libclc and the target.
This commit adds a tool for remangling libclc bitcode files such that the mangled names match the primitive types for the target.
Additionally it creates aliases where appropriate, eg. if
long
is 32 bits on the target a function usinglong
will have its mangling changed to appear as if it is usinglong long
instead, and the old mangling will be made an alias to an existing 32-bit integer version of the function if such a function exists.The remangler is used for the SYCL CUDA and ROCm backends to avoid having to "fake"
signed char
,long long
andunsigned long long
in libclc.