Skip to content

Rename f8E4M3 to f8E4M3FN in mlir.extras.types py package #97102

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

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/lib/Support/APFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ enum class fltNanEncoding {
// exponent is all 1s and the significand is non-zero.
IEEE,

// Represents the behavior in the Float8E4M3 floating point type where NaN is
// represented by having the exponent and mantissa set to all 1s.
// Represents the behavior in the Float8E4M3FN floating point type where NaN
// is represented by having the exponent and mantissa set to all 1s.
// This behavior matches the FP8 E4M3 type described in
// https://arxiv.org/abs/2209.05433. We treat both signed and unsigned NaNs
// as non-signalling, although the paper does not state whether the NaN
Expand Down
12 changes: 6 additions & 6 deletions llvm/unittests/ADT/APFloatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5508,8 +5508,8 @@ TEST(APFloatTest, ConvertE4M3FNToE5M2) {
EXPECT_TRUE(losesInfo);
EXPECT_EQ(status, APFloat::opInexact);

// Convert E4M3 denormal to E5M2 normal. Should not be truncated, despite the
// destination format having one fewer significand bit
// Convert E4M3FN denormal to E5M2 normal. Should not be truncated, despite
// the destination format having one fewer significand bit
test = APFloat(APFloat::Float8E4M3FN(), "0x1.Cp-7");
status = test.convert(APFloat::Float8E5M2(), APFloat::rmNearestTiesToEven,
&losesInfo);
Expand Down Expand Up @@ -5647,8 +5647,8 @@ TEST(APFloatTest, Float8E4M3FNAdd) {
int category;
APFloat::roundingMode roundingMode = APFloat::rmNearestTiesToEven;
} AdditionTests[] = {
// Test addition operations involving NaN, overflow, and the max E4M3
// value (448) because E4M3 differs from IEEE-754 types in these regards
// Test addition operations involving NaN, overflow, and the max E4M3FN
// value (448) because E4M3FN differs from IEEE-754 types in these regards
{FromStr("448"), FromStr("16"), "448", APFloat::opInexact,
APFloat::fcNormal},
{FromStr("448"), FromStr("18"), "NaN",
Expand Down Expand Up @@ -6278,8 +6278,8 @@ TEST(APFloatTest, ConvertE4M3FNUZToE5M2FNUZ) {
EXPECT_TRUE(losesInfo);
EXPECT_EQ(status, APFloat::opInexact);

// Convert E4M3 denormal to E5M2 normal. Should not be truncated, despite the
// destination format having one fewer significand bit
// Convert E4M3FNUZ denormal to E5M2 normal. Should not be truncated, despite
// the destination format having one fewer significand bit
losesInfo = true;
test = APFloat(APFloat::Float8E4M3FNUZ(), "0x1.Cp-8");
status = test.convert(APFloat::Float8E5M2FNUZ(), APFloat::rmNearestTiesToEven,
Expand Down
2 changes: 1 addition & 1 deletion mlir/python/mlir/extras/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def ui(width):
bf16 = lambda: BF16Type.get()

f8E5M2 = lambda: Float8E5M2Type.get()
f8E4M3 = lambda: Float8E4M3FNType.get()
f8E4M3FN = lambda: Float8E4M3FNType.get()
f8E4M3B11FNUZ = lambda: Float8E4M3B11FNUZType.get()

none = lambda: NoneType.get()
Expand Down
Loading