fix(hal/metal/device.go): [*Device.CreateComputePipeline] and [*Device.CreateRenderPipeline] resolves translated entrypoint name by [naga.TranslationInfo]#167
Conversation
…vice.CreateRenderPipeline]` resolves translated entrypoint name by `[naga.TranslationInfo]`
[*Device.CreateComputePipeline] and `[*De…[*Device.CreateComputePipeline] and [*Device.CreateRenderPipeline] resolves translated entrypoint name by [naga.TranslationInfo]
kolkov
left a comment
There was a problem hiding this comment.
Great fix! Correctly identified the root cause — naga MSL renames reserved words like main → main_, and the Metal HAL was using the original name. Matches Rust wgpu-hal pattern (device.rs:231).
Two bugs to fix before merge:
1. Vertex entry point looks up in fragmentModule (line ~607)
entrypointName := desc.Vertex.EntryPoint
if translated, ok := fragmentModule.translatedEntrypointNames[entrypointName]; ok {Should be vertexModule, not fragmentModule. Works now only because vertex+fragment typically share the same ShaderModule, but breaks with separate modules.
2. getWorkgroupSize receives translated name but map uses original names (line ~842)
workgroupSize := getWorkgroupSize(computeModule, entrypointName)extractWorkgroupSizes stores ep.Name (original) as key. After translation "main" → "main_", lookup misses → falls back to {64,1,1} instead of the actual workgroup size. Should use desc.Compute.EntryPoint (original name) here, not entrypointName.
Minor
- Field name
translatedEntrypointNames→entryPointNames(Go convention, matches nagaTranslationInfo.EntryPointNames) - Non-WGSL path:
map[string]string{}→nil(nil map lookup returnsfalse, same behavior, simpler)
fix: fix getWorkgroupSize argument gogpu#167 (review)
|
Thanks! I've fix my code! Please check it when you have a moment 🙏 |
kolkov
left a comment
There was a problem hiding this comment.
Both issues fixed. LGTM! 🎉
vertexModulecorrectly used for vertex entry point lookupentrypointNamesfield name is cleanergetWorkgroupSizecorrectly uses original name
Great contribution — solid root cause analysis and clean fix.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
resolve #168