Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
[mono][wasm] Add Truncate/CopySign/ScaleB intrinsics + narrow #103347 test exemption#129727
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
04a638b
[mono][wasm] Add Truncate/CopySign/ScaleB intrinsics for interpreter …
lewing e25d585
Filter NaN rows from Half/BFloat16 conversion test data on WASM
lewing 7448a4f
Fix jiterpreter range checks and export scalbn/scalbnf for WASM
lewing 6781637
Tighten NaN-row filter to Mono+WASM specifically
lewing cae2655
Correct comment wording for the WASM NaN-payload filter
lewing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
14 changes: 13 additions & 1 deletion
14 src/libraries/System.Runtime/tests/System.Runtime.Tests/System/HalfTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 26 additions & 2 deletions
28 src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Numerics/BFloat16Tests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -532,13 +532,25 @@ public static IEnumerable<object[]> ExplicitConversion_FromSingle_TestData() | ||
| foreach ((float original, BFloat16 expected) in data) | ||
| { | ||
| // WASM on Mono lowers `float.Min` / `float.Max` through `f32.min` / `f32.max` | ||
| // (and `float.IsNaN(...)` branches through `f32.add`). The WebAssembly spec | ||
| // permits NaN-payload canonicalization on these ops but doesn't require it -- | ||
| // arch-native targets (Arm64, xArch) don't canonicalize, at most stripping | ||
| // the signaling bit per IEEE 754. The V8 engine used by the CI Helix queues | ||
| // does canonicalize, so the bit-strict NaN cases in this theory don't round- | ||
| // trip through the software conversion path in that environment. Gated on | ||
| // Mono specifically since other WASM runtimes don't share this lowering. | ||
| // Tracked in https://github.com/dotnet/runtime/issues/103347; this filter can | ||
| // be removed once the conversion path either avoids the canonicalizing ops | ||
| // or the host engines start preserving NaN payloads. | ||
| if (PlatformDetection.IsMonoRuntime && PlatformDetection.IsWasm && float.IsNaN(original)) | ||
| continue; | ||
lewing marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| yield return new object[] { original, expected }; | ||
| } | ||
| } | ||
| [MemberData(nameof(ExplicitConversion_FromSingle_TestData))] | ||
| [Theory] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/103347", TestPlatforms.Browser)] | ||
| public static void ExplicitConversion_FromSingle(float f, BFloat16 expected) // Check the underlying bits for verifying NaNs | ||
| { | ||
| BFloat16 b16 = (BFloat16)f; | ||
| @@ -618,13 +630,25 @@ public static IEnumerable<object[]> ExplicitConversion_FromDouble_TestData() | ||
| foreach ((double original, BFloat16 expected) in data) | ||
| { | ||
| // WASM on Mono lowers `double.Min` / `double.Max` through `f64.min` / `f64.max` | ||
| // (and `double.IsNaN(...)` branches through `f64.add`). The WebAssembly spec | ||
| // permits NaN-payload canonicalization on these ops but doesn't require it -- | ||
| // arch-native targets (Arm64, xArch) don't canonicalize, at most stripping | ||
| // the signaling bit per IEEE 754. The V8 engine used by the CI Helix queues | ||
| // does canonicalize, so the bit-strict NaN cases in this theory don't round- | ||
| // trip through the software conversion path in that environment. Gated on | ||
| // Mono specifically since other WASM runtimes don't share this lowering. | ||
| // Tracked in https://github.com/dotnet/runtime/issues/103347; this filter can | ||
| // be removed once the conversion path either avoids the canonicalizing ops | ||
| // or the host engines start preserving NaN payloads. | ||
| if (PlatformDetection.IsMonoRuntime && PlatformDetection.IsWasm && double.IsNaN(original)) | ||
| continue; | ||
| yield return new object[] { original, expected }; | ||
| } | ||
| } | ||
| [MemberData(nameof(ExplicitConversion_FromDouble_TestData))] | ||
| [Theory] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/103347", TestPlatforms.Browser)] | ||
| public static void ExplicitConversion_FromDouble(double d, BFloat16 expected) // Check the underlying bits for verifying NaNs | ||
| { | ||
| BFloat16 b16 = (BFloat16)d; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -282,6 +282,8 @@ export const mathIntrinsicTable: { [opcode: number]: [isUnary: boolean, isF32: b | ||
| [MintOpcode.MINT_FLOORF]: [true, true, WasmOpcode.f32_floor], | ||
| [MintOpcode.MINT_ABS]: [true, false, WasmOpcode.f64_abs], | ||
| [MintOpcode.MINT_ABSF]: [true, true, WasmOpcode.f32_abs], | ||
| [MintOpcode.MINT_TRUNC]: [true, false, WasmOpcode.f64_trunc], | ||
| [MintOpcode.MINT_TRUNCF]: [true, true, WasmOpcode.f32_trunc], | ||
lewing marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| [MintOpcode.MINT_ACOS]: [true, false, "acos"], | ||
| [MintOpcode.MINT_ACOSF]: [true, true, "acosf"], | ||
| @@ -316,6 +318,8 @@ export const mathIntrinsicTable: { [opcode: number]: [isUnary: boolean, isF32: b | ||
| [MintOpcode.MINT_MINF]: [false, true, WasmOpcode.f32_min], | ||
| [MintOpcode.MINT_MAX]: [false, false, WasmOpcode.f64_max], | ||
| [MintOpcode.MINT_MAXF]: [false, true, WasmOpcode.f32_max], | ||
| [MintOpcode.MINT_COPYSIGN]: [false, false, WasmOpcode.f64_copysign], | ||
| [MintOpcode.MINT_COPYSIGNF]:[false, true, WasmOpcode.f32_copysign], | ||
| [MintOpcode.MINT_ATAN2]: [false, false, "atan2"], | ||
| [MintOpcode.MINT_ATAN2F]: [false, true, "atan2f"], | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.