Skip to content

Add option to output multiple files, one per entry point #539

@khyperia

Description

@khyperia

Discussed in #524

Right now, the ecosystem for SPIR-V is quite buggy when handling multiple entry points per spir-v module. We've fought it a lot, but it's time to give up 🔥 and add an option to emit multiple files per crate, one entry point per file.

  1. Add an option to spirv-builder to let the user specify that they want multiple files
  2. Plumb that through to rust-gpu
  3. Near the end of linking (before ID compaction? idk), clone the module N times, where N is the number of entry points. In each one, remove all but one entry point, then run DCE on it.
  4. Output the collection of files somewhere(?). @eddyb said that there's pre-existing code to translate a rust name (e.g. foo::bar) to a filesystem-okay path in MIR dumping, we should re-use that.
  5. Return a HashMap<function name, Path> from spirv-builder to the user ✨somehow✨. @eddyb had the idea of making the rustc artifact actually be a json file that contains that map, and then spirv-builder would read that json and return that map.

Metadata

Metadata

Assignees

Labels

t: enhancementA new feature or improvement to an existing one.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions