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

Fix ptx symbol visibility regression #1609

Merged

Conversation

chellmuth
Copy link
Collaborator

LLVM 14 introduced two ptx regressions to our file-scoped static variables:

  1. They gained the .visible directive
  2. They stopped being optimized out when unused

This lead to duplicate symbol errors when building an OptiX pipeline with multiple shaders.

We attempted a fix using anonymous namespaces in #1561, but kept the static keyword, resulting in a partial solution.

Removing static generates ptx that matches LLVM 12 for the affected variable definitions.


Here's a section of group_0.ptx from testoptix-noise, before and after:

Before:
.visible .const .align 4 .b8 _ZN11OSL_v1_13_23pvt6Spline12_GLOBAL__N_19gBasisSetE[408] = {...};
.visible .const .align 64 .b8 _ZN11OSL_v1_13_23pvt12_GLOBAL__N_112_GLOBAL__N_116cie_colour_matchE[972] = {...};
.visible .const .align 4 .b8 _ZN11OSL_v1_13_23pvt12_GLOBAL__N_115k_color_systemsE[416] = {...};
.visible .const .align 4 .b8 _ZN11OSL_v1_13_23pvt12_GLOBAL__N_14zeroE[16];
.visible .const .align 4 .b8 _ZN11OSL_v1_13_23pvt12_GLOBAL__N_18grad2lutE[64] = {...};
.visible .const .align 4 .b8 _ZN11OSL_v1_13_23pvt12_GLOBAL__N_18grad3lutE[192] = {...};
.visible .const .align 4 .b8 _ZN11OSL_v1_13_23pvt12_GLOBAL__N_18grad4lutE[512] = {...};
.visible .const .align 1 .b8 _ZN11OSL_v1_13_23pvt12_GLOBAL__N_17simplexE[256] = {...};


After:
.const .align 4 .b8 _ZN11OSL_v1_13_13pvt12_GLOBAL__N_18grad2lutE[64] = {...};

Also included: Fix a clang warning that was breaking my -Werror build, although I'm confused why CI didn't catch it previously.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Signed-off-by: Chris Hellmuth <[email protected]>
LLVM 14 introduced two ptx regressions to our file-scoped static variables:
1) They gained the .visible directive
2) They stopped being optimized out when unused

This lead to duplicate symbol errors when building an OptiX pipeline with
multiple shaders.

We attempted a fix using anonymous namespaces in AcademySoftwareFoundation#1561, but kept the static
keyword, resulting in a partial solution.

Removing static generates ptx that matches LLVM 12 for the affected variable
definitions.

Signed-off-by: Chris Hellmuth <[email protected]>
@lgritz lgritz merged commit 3187864 into AcademySoftwareFoundation:main Oct 17, 2022
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.

None yet

2 participants