Thread overview | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 13 Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
_Float16 is new in C23 Appendix H.11-6 https://github.com/dlang/dmd/issues/20516 For the moment, I submitted a PR with a workaround: https://github.com/dlang/dmd/pull/20699 Amazingly, some years ago I implemented 16 bit floats in D: https://github.com/DigitalMars/sargon/blob/master/src/sargon/halffloat.d Would anyone like to put halffloat.d into Druntime and make it our implementation of _Float16? |
January 14 Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 14 January 2025 at 06:13:04 UTC, Walter Bright wrote:
> _Float16 is new in C23 Appendix H.11-6
>
> https://github.com/dlang/dmd/issues/20516
>
> For the moment, I submitted a PR with a workaround:
>
> https://github.com/dlang/dmd/pull/20699
>
> Amazingly, some years ago I implemented 16 bit floats in D:
>
> https://github.com/DigitalMars/sargon/blob/master/src/sargon/halffloat.d
>
> Would anyone like to put halffloat.d into Druntime and make it our implementation of _Float16?
Amazing. Is it extendable to Float8?
Is it compatible with LLVM/GCC and other implementations?
|
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sergey | On 1/13/2025 11:43 PM, Sergey wrote: > Amazing. Is it extendable to Float8? The idea is sound, so probably. > Is it compatible with LLVM/GCC and other implementations? That I don't know. But it could be modified to be. |
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 14 January 2025 at 06:13:04 UTC, Walter Bright wrote: > _Float16 is new in C23 Appendix H.11-6 > > https://github.com/dlang/dmd/issues/20516 > > For the moment, I submitted a PR with a workaround: > > https://github.com/dlang/dmd/pull/20699 > > Amazingly, some years ago I implemented 16 bit floats in D: > > https://github.com/DigitalMars/sargon/blob/master/src/sargon/halffloat.d > > Would anyone like to put halffloat.d into Druntime and make it our implementation of _Float16? Why should it be a "runtime" module? Obviously you know better than most of us, but does it feel good to have to import a module for such thing, is it compelling for people looking for an alternative to C? What the young competition doing? https://ziglang.org/documentation/master/#Primitive-Types https://odin-lang.org/docs/overview/#basic-types https://c3-lang.org/language-overview/types/ |
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | I forgot to introduce this for a decision at the last meeting (lucky given how many items we had). A new policy, that anyone could implement a C numeric type as long as it bound to a druntime module, and not exposed to D. D would need a DIP due to the identifier needing confirmation. Note: this would also mean anyone could implement (u)cent and it would be pre-approved work. Also did you see my email from the day after the meeting? |
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Richard (Rikki) Andrew Cattermole | On Tuesday, 14 January 2025 at 14:34:13 UTC, Richard (Rikki) Andrew Cattermole wrote:
> ...
>
> A new policy, that anyone could implement a C numeric type as long as it bound to a druntime module, and not exposed to D. D would need a DIP due to the identifier needing confirmation.
>
>
Is this a good path to full integration with the back ends? I'd love to see auto vectorization and other optimizations when using the new types.
|
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruce Carneal | On 15/01/2025 4:06 AM, Bruce Carneal wrote:
> On Tuesday, 14 January 2025 at 14:34:13 UTC, Richard (Rikki) Andrew Cattermole wrote:
>> ...
>>
>> A new policy, that anyone could implement a C numeric type as long as it bound to a druntime module, and not exposed to D. D would need a DIP due to the identifier needing confirmation.
>>
>>
>
> Is this a good path to full integration with the back ends? I'd love to see auto vectorization and other optimizations when using the new types.
Yes.
The functions involved can be recognized as intrinsics, and swapped out for the IR version of it.
|
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sergey | On Tuesday, 14 January 2025 at 07:43:42 UTC, Sergey wrote: > On Tuesday, 14 January 2025 at 06:13:04 UTC, Walter Bright wrote: >> _Float16 is new in C23 Appendix H.11-6 >> >> https://github.com/dlang/dmd/issues/20516 >> >> For the moment, I submitted a PR with a workaround: >> >> https://github.com/dlang/dmd/pull/20699 >> >> Amazingly, some years ago I implemented 16 bit floats in D: >> >> https://github.com/DigitalMars/sargon/blob/master/src/sargon/halffloat.d >> >> Would anyone like to put halffloat.d into Druntime and make it our implementation of _Float16? > > Amazing. Is it extendable to Float8? Phobos also contains CustomFloat: https://dlang.org/library/std/numeric/custom_float.html This allows to have floats with a custom number of bits, including 8 bits. |
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to ryuukk_ | On 1/14/2025 12:33 AM, ryuukk_ wrote: > Why should it be a "runtime" module? If it is to be part of the core language, that's where it goes. > Obviously you know better than most of us, but does it feel good to have to import a module for such thing, is it compelling for people looking for an alternative to C? > > What the young competition doing? > > https://ziglang.org/documentation/master/#Primitive-Types > https://odin-lang.org/docs/overview/#basic-types > https://c3-lang.org/language-overview/types/ The interesting thing is not the existence of the types. It's how they are implemented. The X86_64 architecture does not support a 16 bit floating point type. |
6 days ago Re: Implementing C23 _Float16 in ImportC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Richard (Rikki) Andrew Cattermole | On 1/14/2025 6:34 AM, Richard (Rikki) Andrew Cattermole wrote:
> Also did you see my email from the day after the meeting?
No. What was the subject title?
|
Copyright © 1999-2021 by the D Language Foundation