Fix slow compilation of large zero-initialized arrays; warn on large non-zero fills#586
Fix slow compilation of large zero-initialized arrays; warn on large non-zero fills#58639ali wants to merge 1 commit intoRust-GPU:mainfrom
Conversation
…e with N operands
Firestar99
left a comment
There was a problem hiding this comment.
Fix slow compilation
First, could you explain what kind of slowdown you're seeing?
use OpConstantNull instead when fill_byte == 0
I like that idea, although I'm unsure if spirt supports that command @eddyb?
will create a huge list of repeated store instructions
Isn't the bug then that the emitted OpConstantComposite was broken up into a bunch of individual OpStore instructions / not being reassembled into an OpCompositeConstruct / OpConstantComposite? (Our destructure_composites post-link pass may be related to this?)
|
i needed to clarify that for First, could you explain what kind of slowdown you're seeing?compile time is slow, i believe its because of the long i'll attach the .spv file for this shader : |
let arr = [0; 32 * 1024]compiled very slowly. The cause: Rvalue::Repeat with a zero element routes throughmemset, while will create a huge list of repeated store instructions, the fix: useOpConstantNullinstead whenfill_byte == 0, valid for any SPIR-V composite type, single instruction regardless of size.SPIR-V has no equivalent of
OpConstantNullfor non-zero values , so the best we can do is tell the user early by emitting a warning