-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Documentation: Remove warning that nonstandard primitive type sizes may reveal LLVM bugs #58262
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
base: master
Are you sure you want to change the base?
Conversation
Only primitive types which are a multiple of 8 bits in size can be constructed. Therefore, the documentation should not speculate about possible bugs in other non-reachable cases. Additionally, it's not clear whether these LLVM bugs still exist now that C allows all integers sizes.
It would be pretty nice if we could enable support for arbitrary size primitive types. LLVM should be able to do so now that C Rust and Zig all support it. |
Yes, this would be nice, but unfortunately out-of-scope for this PR. Arbitrary bit sized primitives need at least two large changes to be really useful (each worth at least one separate PR):
I am currently working on two packages which would mostly circumvent these issues. However, I need to clarify whether we'll open-source them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Sizes used above" refers to 2 .^ (3:7)
, so the clause this PR removes isn't about multiples of 8 bits but about sizes that are larger or not powers of 2.
An accurate title for this PR would be "Remove warning that nonstandard primitive type sizes may reveal LLVM bugs"
Maybe I was too fast. Supporting arbitrary sized primitives which have a byte-sized It would open a can of worms for discussions about how This could make one of the two mentioned packages obsolete in the long run. |
Is this not already supported? julia> primitive type T 24 end
julia> sizeof(T)
3 |
What we're talking about here is |
@@ -301,7 +301,7 @@ a name. A primitive type can optionally be declared to be a subtype of some supe | |||
is omitted, then the type defaults to having `Any` as its immediate supertype. The declaration | |||
of [`Bool`](@ref) above therefore means that a boolean value takes eight bits to store, and has | |||
[`Integer`](@ref) as its immediate supertype. Currently, only sizes that are multiples of | |||
8 bits are supported and you are likely to experience LLVM bugs with sizes other than those used above. | |||
8 bits are supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @LilithHafner already pointed out, the removed sentence did not refer to the "multiples of 8 bits" but rather to "sizes [...] used above", i.e. "8, 16, 32, 64, 128"
So the question then is: we sure that e.g. 24 or 48 work fine now and there are no LLVM bugs to be encountered? Then removing this sentence makes sense -- but I'd feel better about that if there were some actual tests in the test suite exercising that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BitIntegers.jl's test suite covers 24, 200, 256, 512 and 1024 bits with more than 500 lines of test files.
We are also using non-power-of-two byte sizes in the company I work for and do not have observed a single LLVM
bug.
C
, Rust
and Zig
should use the same LLVM
code paths.
Proving the absence of bugs is hard. I have the feeling that we treat this differently compared to what we normally do: Normally we assume that LLVM
works correctly and we normally do not mention bugs in other software we use. Shouldn't we have proof of bugs if we say so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the feeling that we treat this differently compared to what we normally do
I think this is just an instance of once bitten, twice shy. We know LLVM used to have a bunch of bugs here. That said, given BitIntegers tests, I think this is good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deleted comment used to be true, but I'm not aware of current LLVM (or Julia) bugs with these primitive types.
Only primitive types which are a multiple of 8 bits in size can be constructed. Therefore, the documentation should not speculate about possible bugs in other non-reachable cases.
Additionally, it's not clear whether these LLVM bugs still exist now that C allows all integers sizes.