Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cuda: Add more formats for texture read/write #7012

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mkeshavaNV
Copy link
Contributor

@mkeshavaNV mkeshavaNV commented May 6, 2025

This PR Fixes #7002 and #7025. Details are as shown below

#7025

  1. Extend tests/compute/rw-texture-simple.slang to use float2/float4.

#7002
2. Extend subscript operator support to include vectors.

  • PR Add subscript operator support in cuda #6830 implemented texture reads on read-only textures but this was done only for scalars.
  • This PR extends it for vectors. So adds support for float2/float4
  • Also adds a new test for uint tests.

@mkeshavaNV mkeshavaNV added the pr: non-breaking PRs without breaking changes label May 8, 2025
@mkeshavaNV mkeshavaNV changed the title WiP: Add more formats for texture reads cuda: Add more formats for texture reads May 8, 2025
@mkeshavaNV
Copy link
Contributor Author

/format

@mkeshavaNV mkeshavaNV changed the title cuda: Add more formats for texture reads cuda: Add more formats for texture read/write May 8, 2025
@slangbot
Copy link
Contributor

slangbot commented May 8, 2025

🌈 Formatted, please merge the changes from this PR

mkeshavaNV added a commit to mkeshavaNV/slang that referenced this pull request May 8, 2025
@mkeshavaNV
Copy link
Contributor Author

/format

@slangbot
Copy link
Contributor

slangbot commented May 8, 2025

🌈 Formatted, please merge the changes from this PR

@mkeshavaNV mkeshavaNV marked this pull request as ready for review May 8, 2025 10:47
@mkeshavaNV mkeshavaNV requested a review from a team as a code owner May 8, 2025 10:47
@mkeshavaNV mkeshavaNV requested a review from expipiplus1 May 8, 2025 10:48
skallweitNV
skallweitNV previously approved these changes May 8, 2025
Copy link
Collaborator

@skallweitNV skallweitNV left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -14,6 +14,10 @@ RWTexture1D<float> rwt1D;
RWTexture2D<float> rwt2D;
//TEST_INPUT: RWTexture3D(format=R32Float, size=4, content = one, mipMaps = 1):name rwt3D
RWTexture3D<float> rwt3D;
//TEST_INPUT: RWTexture2D(format=RG32Float, size=4, content = one, mipMaps = 1):name rwt2D_float2
RWTexture2D<float2> rwt2D_float2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could add float2/float4 versions for 1D and 3D as well to improve coverage even further

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skallweitNV - good suggestion. Added.

SLANG_FORCE_INLINE SLANG_CUDA_CALL float2 tex2Dfetch_int(CUtexObject texObj, int x, int y)
{
float result_x, result_y;
float dummy;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Coding style: we should avoid using offensive terms like dummy here. Consider “placeholder”, “stub”, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

}
}

// CHECK:0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Generally avoid results that are 0, because various failures can also result a value being 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@mkeshavaNV mkeshavaNV requested a review from expipiplus1 May 9, 2025 05:31
@mkeshavaNV mkeshavaNV requested review from skallweitNV and csyonghe May 9, 2025 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CUDA] Texture reads emit invalid code
5 participants