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

Deduplicate constant data tables #2849

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

AMD-dwang
Copy link
Contributor

A constant data is assigned to different variables several times, then we will create multiple globalVariables, which causes the constant data is repeated in the .rodata section with different names. Like this:
.rodata (size = 1344 bytes)
__unnamed_3 (offset = 0 size = 448 hash = 0xB186021131D03E38)
(offset = 0 size = 0 hash = 0x071E967D705FB008)
0:3F1FE7C0 3F0B1A4C 3F53F141 00000000 BE095BFF BF71E3A8 3F745048 00000000
32:3EC6833C BEDE978D 3F1520B0 00000000 3DF8572A BE45729B 3E693F29 00000000
...
__unnamed_2 (offset = 448 size = 448 hash = 0xB186021131D03E38)
448:3F1FE7C0 3F0B1A4C 3F53F141 00000000 BE095BFF BF71E3A8 3F745048 00000000
480:3EC6833C BEDE978D 3F1520B0 00000000 3DF8572A BE45729B 3E693F29 00000000
...
__unnamed_1 (offset = 896 size = 448 hash = 0xB186021131D03E38)
896:3F1FE7C0 3F0B1A4C 3F53F141 00000000 BE095BFF BF71E3A8 3F745048 00000000
928:3EC6833C BEDE978D 3F1520B0 00000000 3DF8572A BE45729B 3E693F29 00000000
...

For the globalVariable that the initialization values are the same, we should treat them as the same variable.

@AMD-dwang AMD-dwang requested a review from a team as a code owner November 28, 2023 07:07
Copy link
Contributor

@jasilvanus jasilvanus left a comment

Choose a reason for hiding this comment

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

This misses the include of <unordered_map>.

Also, we should clear the map when entering ::run.

Nit: Aren't we preferring llvm::DenseMap?

@amdvlk-admin
Copy link
Collaborator

Test summary for commit 829e85f

CTS tests (Failed: 0/138443)
  • Built with version 1.3.5.2
  • Ubuntu navi3x, Srdcvk
    • Passed: 35211/69228 (50.9%)
    • Failed: 0/69228 (0.0%)
    • Not Supported: 34017/69228 (49.1%)
    • Warnings: 0/69228 (0.0%)
    Ubuntu navi2x, Srdcvk
    • Passed: 35242/69215 (50.9%)
    • Failed: 0/69215 (0.0%)
    • Not Supported: 33973/69215 (49.1%)
    • Warnings: 0/69215 (0.0%)

@AMD-dwang
Copy link
Contributor Author

This misses the include of <unordered_map>.

Also, we should clear the map when entering ::run.

Nit: Aren't we preferring llvm::DenseMap?

The header file <unordered_map> is included in other file. Anyway, I'll change it to DenseMap. thanks

@amdvlk-admin
Copy link
Collaborator

Test summary for commit 87d0d6d

CTS tests (Failed: 0/138443)
  • Built with version 1.3.5.2
  • Ubuntu navi3x, Srdcvk
    • Passed: 35211/69228 (50.9%)
    • Failed: 0/69228 (0.0%)
    • Not Supported: 34017/69228 (49.1%)
    • Warnings: 0/69228 (0.0%)
    Ubuntu navi2x, Srdcvk
    • Passed: 35242/69215 (50.9%)
    • Failed: 0/69215 (0.0%)
    • Not Supported: 33973/69215 (49.1%)
    • Warnings: 0/69215 (0.0%)

Copy link
Member

@Flakebi Flakebi left a comment

Choose a reason for hiding this comment

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

One nit, otherwise LGTM

llpc/lower/llpcSpirvLowerConstImmediateStore.cpp Outdated Show resolved Hide resolved
A constant data is assigned to different variables several times, then
we will create multiple globalVariables, which causes the constant data
is repeated in the .rodata section with different names.
Like this:
.rodata (size = 1344 bytes)
    __unnamed_3 (offset = 0  size = 448 hash = 0xB186021131D03E38)
     (offset = 0  size = 0 hash = 0x071E967D705FB008)
          0:3F1FE7C0 3F0B1A4C 3F53F141 00000000 BE095BFF BF71E3A8 3F745048 00000000
         32:3EC6833C BEDE978D 3F1520B0 00000000 3DF8572A BE45729B 3E693F29 00000000
         ...
    __unnamed_2 (offset = 448  size = 448 hash = 0xB186021131D03E38)
        448:3F1FE7C0 3F0B1A4C 3F53F141 00000000 BE095BFF BF71E3A8 3F745048 00000000
        480:3EC6833C BEDE978D 3F1520B0 00000000 3DF8572A BE45729B 3E693F29 00000000
        ...
    __unnamed_1 (offset = 896  size = 448 hash = 0xB186021131D03E38)
        896:3F1FE7C0 3F0B1A4C 3F53F141 00000000 BE095BFF BF71E3A8 3F745048 00000000
        928:3EC6833C BEDE978D 3F1520B0 00000000 3DF8572A BE45729B 3E693F29 00000000
        ...

For the globalVariable that the initialization values are the same, we
should treat them as the same variable.
Copy link
Member

@Flakebi Flakebi left a comment

Choose a reason for hiding this comment

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

Thanks

@amdvlk-admin
Copy link
Collaborator

Test summary for commit f646e54

CTS tests (Failed: 0/138443)
  • Built with version 1.3.5.2
  • Ubuntu navi3x, Srdcvk
    • Passed: 35211/69228 (50.9%)
    • Failed: 0/69228 (0.0%)
    • Not Supported: 34017/69228 (49.1%)
    • Warnings: 0/69228 (0.0%)
    Ubuntu navi2x, Srdcvk
    • Passed: 35242/69215 (50.9%)
    • Failed: 0/69215 (0.0%)
    • Not Supported: 33973/69215 (49.1%)
    • Warnings: 0/69215 (0.0%)

@AMD-dwang AMD-dwang merged commit f9da391 into GPUOpen-Drivers:dev Nov 29, 2023
10 checks passed
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.

6 participants