Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYNC-HAZARD-WRITE-AFTER-WRITE when writing to multiple mips in the same dispatch #85

Open
DGriffin91 opened this issue Aug 29, 2024 · 1 comment

Comments

@DGriffin91
Copy link
Contributor

DGriffin91 commented Aug 29, 2024

I have a compute shader that writes to multiple mips of the same texture in one dispatch. When I run it I get SYNC-HAZARD-WRITE-AFTER-WRITE

Minimal code example (based on screen-13 triangle example, with current main 0.38 ash support, bdc4a81)
https://gist.github.com/DGriffin91/d792f15c1d0ae0c323f3b64e50968abf

In this example the mips are created as expected and if you uncomment the pass that displays the mip it does display.

In my app, it actually results in ERROR_OUT_OF_POOL_MEMORY if I try to sample the mip in another pass. But seems to otherwise create the mips as expected (viewed in render doc) if I don't try to sample them.

Edit: In my app I made a simpler pass to just render a debug output of the textures and it this doesn't cause the ERROR_OUT_OF_POOL_MEMORY but does still show the WRITE-AFTER-WRITE

@DGriffin91
Copy link
Contributor Author

It looks like in the bindings only the first and last mip show a subresource access. Not sure if this could be related.

.record_compute(move |compute, bindings| {
    dbg!(&bindings);
    compute.dispatch(width / 8 + 1, height / 8 + 1, 1);
});
3: [
    SubresourceAccess {
        access: General,
        subresource: Some(
            Image(
                ImageSubresource {
                    array_layer_count: Some(1),
                    aspect_mask: COLOR,
                    base_array_layer: 0,
                    base_mip_level: 0,
                    mip_level_count: Some(1),
                },
            ),
        ),
    },
    SubresourceAccess {
        access: General,
        subresource: Some(
            Image(
                ImageSubresource {
                    array_layer_count: Some(1),
                    aspect_mask: COLOR,
                    base_array_layer: 0,
                    base_mip_level: 2,
                    mip_level_count: Some(1),
                },
            ),
        ),
    },
],

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

No branches or pull requests

1 participant