Skip to content

Fix slow compilation of large zero-initialized arrays; warn on large non-zero fills#586

Open
39ali wants to merge 1 commit intoRust-GPU:mainfrom
39ali:array-memset
Open

Fix slow compilation of large zero-initialized arrays; warn on large non-zero fills#586
39ali wants to merge 1 commit intoRust-GPU:mainfrom
39ali:array-memset

Conversation

@39ali
Copy link
Copy Markdown
Contributor

@39ali 39ali commented Apr 22, 2026

let arr = [0; 32 * 1024] compiled very slowly. The cause: Rvalue::Repeat with a zero element routes through memset, while will create a huge list of repeated store instructions, the fix: use OpConstantNull instead when fill_byte == 0, valid for any SPIR-V composite type, single instruction regardless of size.

SPIR-V has no equivalent of OpConstantNull for non-zero values , so the best we can do is tell the user early by emitting a warning

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.

1 participant