Skip to content
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

[wasm] WasmBase.IsSupported no longer returns true #88494

Closed
vargaz opened this issue Jul 6, 2023 · 4 comments
Closed

[wasm] WasmBase.IsSupported no longer returns true #88494

vargaz opened this issue Jul 6, 2023 · 4 comments
Labels
arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@vargaz
Copy link
Contributor

vargaz commented Jul 6, 2023

Description

Testcase:

using System;
using System.Numerics;

public class Test
{
    public static int Main () {
        int sum = 0;
        for (int i = 0; i < 100000000; ++i) {
            sum += BitOperations.Log2 ((ulong)i);
        }
        return sum;
    }
}

JIT debug output:

converting (in B14: stack: 0) IL_000f: call      0x0600137b
cmethod = bool System.Runtime.Intrinsics.Wasm.WasmBase:get_IsSupported ()
	->  false

What seems to be happening is that the JIT first calls
arch_emit_simd_intrinsics (), which calls

	if (!strcmp (class_ns, "System.Runtime.Intrinsics.Wasm")) {
		return emit_hardware_intrinsics (cfg, cmethod, fsig, args,
			supported_wasm_intrinsics, sizeof (supported_wasm_intrinsics),
			emit_wasm_supported_intrinsics);
	}

Which doesn't handle WasmBase, but it still returns a MonoInst for WasmBase:get_IsSupported (), so
arch_emit_common_intrinsics () is never called.

Reproduction Steps

.

Expected behavior

.

Actual behavior

.

Regression?

Yes

Known Workarounds

No response

Configuration

dotnet/runtime master

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 6, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 6, 2023
@ghost
Copy link

ghost commented Jul 6, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Testcase:

using System;
using System.Numerics;

public class Test
{
    public static int Main () {
        int sum = 0;
        for (int i = 0; i < 100000000; ++i) {
            sum += BitOperations.Log2 ((ulong)i);
        }
        return sum;
    }
}

JIT debug output:

converting (in B14: stack: 0) IL_000f: call      0x0600137b
cmethod = bool System.Runtime.Intrinsics.Wasm.WasmBase:get_IsSupported ()
	->  false

What seems to be happening is that the JIT first calls
arch_emit_simd_intrinsics (), which calls

	if (!strcmp (class_ns, "System.Runtime.Intrinsics.Wasm")) {
		return emit_hardware_intrinsics (cfg, cmethod, fsig, args,
			supported_wasm_intrinsics, sizeof (supported_wasm_intrinsics),
			emit_wasm_supported_intrinsics);
	}

Which doesn't handle WasmBase, but it still returns a MonoInst for WasmBase:get_IsSupported (), so
arch_emit_common_intrinsics () is never called.

Reproduction Steps

.

Expected behavior

.

Actual behavior

.

Regression?

Yes

Known Workarounds

No response

Configuration

dotnet/runtime master

Other information

No response

Author: vargaz
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@vargaz vargaz added the arch-wasm WebAssembly architecture label Jul 6, 2023
@ghost
Copy link

ghost commented Jul 6, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Testcase:

using System;
using System.Numerics;

public class Test
{
    public static int Main () {
        int sum = 0;
        for (int i = 0; i < 100000000; ++i) {
            sum += BitOperations.Log2 ((ulong)i);
        }
        return sum;
    }
}

JIT debug output:

converting (in B14: stack: 0) IL_000f: call      0x0600137b
cmethod = bool System.Runtime.Intrinsics.Wasm.WasmBase:get_IsSupported ()
	->  false

What seems to be happening is that the JIT first calls
arch_emit_simd_intrinsics (), which calls

	if (!strcmp (class_ns, "System.Runtime.Intrinsics.Wasm")) {
		return emit_hardware_intrinsics (cfg, cmethod, fsig, args,
			supported_wasm_intrinsics, sizeof (supported_wasm_intrinsics),
			emit_wasm_supported_intrinsics);
	}

Which doesn't handle WasmBase, but it still returns a MonoInst for WasmBase:get_IsSupported (), so
arch_emit_common_intrinsics () is never called.

Reproduction Steps

.

Expected behavior

.

Actual behavior

.

Regression?

Yes

Known Workarounds

No response

Configuration

dotnet/runtime master

Other information

No response

Author: vargaz
Assignees: -
Labels:

arch-wasm, area-CodeGen-coreclr, untriaged

Milestone: -

@vargaz vargaz added this to the 8.0.0 milestone Jul 6, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 6, 2023
@vargaz
Copy link
Contributor Author

vargaz commented Jul 6, 2023

@radekdoulik

@vargaz
Copy link
Contributor Author

vargaz commented Jul 9, 2023

Fixed by #88523.

@vargaz vargaz closed this as completed Jul 9, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

No branches or pull requests

1 participant