Skip to content

[TableGen][MVT] Lower the maximum 16-bit MVT from 16384 to 511. #101401

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 1 commit into from
Aug 1, 2024

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Jul 31, 2024

MachineValueTypeSet in tablegen allocates an array with a bit per MVT. This used to be 256 bits, with the introduction of 16-bit MVT it ballooned to 65536 bits. I suspect this is increasing the memory usage of many of the data structures used by CodeGenDAGPatterns.

Since we don't need the full 16-bit range yet, this patch proposes lowering the maximum MVT to 511 and using only 512 bits for MachineValueTypeSet's storage.

MachineValueTypeSet in tablegen allocates an array with a bit per
MVT. This used to be 256 bits, with the introduction of 16-bit MVT
it ballooned to 65536 bits. I suspect this is increasing the memory
usage of many of the data structures used by CodeGenDAGPatterns.

Since we don't need the full 16-bit range yet, this patch proposes
lowering the maximum MVT to 511 and using only 512 bits for
MachineValueTypeSet's storage.
@MaskRay
Copy link
Member

MaskRay commented Aug 1, 2024

The 16-bit MVT patch increased both run time and memory usage greatly: =time -f '%M %e' -gen-global-isel llvm/lib/Target/RISCV/RISCVGISel.td

1207644 4.80
17415668 16.60

Let's try this. If this doesn't make the memory usage down, I think we will need to revert the 16-bit MVT.

@topperc
Copy link
Collaborator Author

topperc commented Aug 1, 2024

This definitely improved things for me. 22 seconds down to 7 seconds.

@topperc topperc merged commit e2c74aa into llvm:main Aug 1, 2024
8 checks passed
@topperc topperc deleted the pr/mvt-memory branch August 1, 2024 01:52
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