Skip to content

test(metal): align storage-mode fixture with GPU policy - #275

Merged
kolkov merged 1 commit into
gogpu:mainfrom
besmpl:besmpl/fix-metal-private-staging-mode
Jul 24, 2026
Merged

test(metal): align storage-mode fixture with GPU policy#275
kolkov merged 1 commit into
gogpu:mainfrom
besmpl:besmpl/fix-metal-private-staging-mode

Conversation

@besmpl

@besmpl besmpl commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • drive the layered Queue.WriteTexture storage-mode matrix through Device.isAppleGPU, the predicate production texture allocation actually uses
  • skip the Shared-direct cases when the host does not expose an Apple GPU family
  • leave Metal production behavior unchanged

Root cause

The test added in #261 simulated Private and Shared texture allocation by changing hasUnifiedMemory. After #272, texture allocation intentionally uses Apple GPU-family membership (isAppleGPU) instead, avoiding Shared texture policy on Intel/AMD devices.

On Apple Silicon, the stale fixture therefore could not force the private staging case: CreateTexture still saw isAppleGPU=true, allocated Shared storage, and failed the expectation:

texture shared mode = true; want false

This updates the test injection point to match the current policy. The Private-staging and Shared-direct data paths remain exercised on Apple GPUs; non-Apple GPUs continue to exercise the production-supported Private path.

Validation

  • CGO_ENABLED=0 GOWORK=off go test -count=1 ./hal/metal -run '^TestQueueWriteTextureLayeredShapes/1D_array/private_staging$' -v
  • full layered storage matrix, repeated three times
  • CGO_ENABLED=0 GOWORK=off go test -count=1 ./hal/metal
  • CGO_ENABLED=0 GOWORK=off go test -count=1 ./...
  • CGO_ENABLED=0 GOWORK=off go test -count=1 -tags rust ./...
  • default and Rust-tagged builds, plus the root WASM build

The complete local macOS default and Rust-tagged test runs now pass without excluding hal/metal. This is deliberately separate from Android PR #268.

@besmpl
besmpl requested a review from kolkov as a code owner July 24, 2026 09:03
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kolkov kolkov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix. The test injection was stale after #272 switched texture storage policy from hasUnifiedMemory to isAppleGPU — this aligns the fixture with the actual production predicate. Verified that CreateTexture (device.go:233) uses d.isAppleGPU, so the old hasUnifiedMemory toggle was a no-op for texture allocation. LGTM.

@kolkov
kolkov merged commit abbaf2f into gogpu:main Jul 24, 2026
13 checks passed
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