Skip to content

Commit 50a208a

Browse files
eddybeduardosm
authored andcommitted
Add TF32
This floating point type is used by some accelerators (e.g., AMD and NVIDIA GPUs) Upstream LLVM commit: 55c2211a233e11179048cf58778f40e5a62f444a
1 parent 055db61 commit 50a208a

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
members = ["fuzz"]
33

44
[workspace.package]
5-
version = "0.2.0+llvm-687bd77e2c26"
5+
version = "0.2.0+llvm-55c2211a233e"
66
edition = "2021"
77
license = "Apache-2.0 WITH LLVM-exception"
88

fuzz/ops.rs

+2
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ struct FuzzOp {
331331
(8, "Float8E4M3FNUZ"),
332332
(8, "Float8E4M3B11FNUZ"),
333333
(16, "BFloat"),
334+
(19, "FloatTF32"),
334335
(80, "x87DoubleExtended"),
335336
]
336337
.into_iter()
@@ -339,6 +340,7 @@ struct FuzzOp {
339340
let name = match (w, cxx_apf_semantics) {
340341
(8, s) if s.starts_with("Float8") => s.replace("Float8", "F8"),
341342
(16, "BFloat") => "BrainF16".into(),
343+
(19, "FloatTF32") => "NV_TensorF32".into(),
342344
(80, "x87DoubleExtended") => "X87_F80".into(),
343345
_ => {
344346
assert!(cxx_apf_semantics.starts_with("IEEE"));

fuzz/src/main.rs

+5
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ float_reprs! {
263263
const REPR_TAG = 16 + 1;
264264
extern fn = cxx_apf_fuzz_eval_op_brainf16;
265265
}
266+
NV_TensorF32(u32) {
267+
type RustcApFloat = rustc_apfloat::ieee::FloatTF32;
268+
const REPR_TAG = 32 + 1;
269+
extern fn = cxx_apf_fuzz_eval_op_nv_tensorf32;
270+
}
266271
X87_F80(u128) {
267272
type RustcApFloat = rustc_apfloat::ieee::X87DoubleExtended;
268273
extern fn = cxx_apf_fuzz_eval_op_x87_f80;

src/ieee.rs

+5
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ ieee_semantics! {
386386
const NAN_ENCODING: NanEncoding = NanEncoding::NegativeZero;
387387
const MIN_EXP: ExpInt = Self::IEEE_MIN_EXP - 4;
388388
},
389+
390+
// Floating point number that occupies 32 bits or less of storage, providing
391+
// improved range compared to half (16-bit) formats, at (potentially)
392+
// greater throughput than single precision (32-bit) formats.
393+
FloatTF32 = FloatTF32S(19:8),
389394
}
390395

391396
// FIXME(eddyb) consider moving X87-specific logic to a "has explicit integer bit"

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Port of LLVM's APFloat software floating-point implementation from the
22
//! following C++ sources (please update commit hash when backporting):
3-
//! https://github.com/llvm/llvm-project/commit/687bd77e2c26487cba727aacfa7067dd01286be0
3+
//! https://github.com/llvm/llvm-project/commit/55c2211a233e11179048cf58778f40e5a62f444a
44
//! * `llvm/include/llvm/ADT/APFloat.h` -> `Float` and `FloatConvert` traits
55
//! * `llvm/lib/Support/APFloat.cpp` -> `ieee` and `ppc` modules
66
//! * `llvm/unittests/ADT/APFloatTest.cpp` -> `tests` directory

0 commit comments

Comments
 (0)