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

[SYCL][COMPAT] Add helper function lop3() to perform bitwise logical operations on three input values based on the specified 8-bit truth table #16509

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

tomflinda
Copy link
Contributor

Signed-off-by: chenwei.sun [email protected]

@JackAKirk
Copy link
Contributor

This is new functionality so this PR is missing a e2e test.

/// \returns The result
inline uint32_t lop3(uint32_t a, uint32_t b, uint32_t c, uint8_t lut) {
uint32_t result = 0;

Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to use the optimized instructions for backends when available, so that translation does not reduce performance wrt cuda.

Suggested change
#if defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)
asm volatile("lop3.b32 %0, %1, %2, %3, %4;"
: "=r"(result)
: "r"(a), "r"(b), "r"(c), "r"(lut));
#else

See later corresponding #endif suggestion

// Set the output bit in the result
result |= (output_bit << i);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#endif // defined(__SYCL_DEVICE_ONLY__) && defined(__NVPTX__)

…operations on three input values based on the specified 8-bit truth table

Signed-off-by: chenwei.sun <[email protected]>
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