Skip to content

[stdlib] Improve type refinement for pack_bits #4345

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 1 commit into
base: main
Choose a base branch
from

Conversation

soraros
Copy link
Contributor

@soraros soraros commented Apr 14, 2025

So the following works without rebind:

var v: UInt8 = pack_bits(SIMD[DType.bool, 8](1))

_uint gets inlined even when n isn't concrete, cluttering tooltips and types.
Can call-by-value be triggered only when n is concrete?

CC @lattner since it's related to @always_inline("builtin").

@soraros soraros requested a review from a team as a code owner April 14, 2025 10:23
return DType.uint64
# fmt: off
return (
DType.uint8 if n == 8
Copy link
Contributor Author

@soraros soraros Apr 14, 2025

Choose a reason for hiding this comment

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

Using the if expression since hlcf.if is not supported in builtin.

@soraros soraros force-pushed the pack-bits-simplify branch from 7069a15 to 103f2d7 Compare April 14, 2025 10:51
@soraros soraros force-pushed the pack-bits-simplify branch from 103f2d7 to 136ec29 Compare April 15, 2025 16:12
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.

1 participant