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

[mono][wasm] Fix a performance regression introduced by #97096. #98515

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

vargaz
Copy link
Contributor

@vargaz vargaz commented Feb 15, 2024

No description provided.

@vargaz
Copy link
Contributor Author

vargaz commented Feb 15, 2024

@radekdoulik

@ghost ghost assigned vargaz Feb 15, 2024
@vargaz
Copy link
Contributor Author

vargaz commented Feb 15, 2024

/azp run runtime-wasm

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vargaz
Copy link
Contributor Author

vargaz commented Feb 15, 2024

Fixes #98522.

@lateralusX
Copy link
Member

@vargaz what happened? Did we end up hitting a case where we reported is_supported as true for a generic type where we should have reported false?

@vargaz
Copy link
Contributor Author

vargaz commented Feb 16, 2024

It made IsSupported return true for the generic shared version of vectors i.e. Vector<T_BYTE>, but we don't support gshared for those types right now.

@lateralusX
Copy link
Member

lateralusX commented Feb 16, 2024

OK, pretty sure that was an issue on some other platforms, that's why I added support for T_BYTE, since it was inline with what the implementation of IsSupported returned in its managed implementation,

Maybe this is just an issue on some platforms?

@vargaz
Copy link
Contributor Author

vargaz commented Feb 16, 2024

With our gsharing implementation, T_BYTE can stand for enums whose basetype is byte as well, so we can't return true for Vector<T_BYTE>.IsSupported. With that code removed, we now hit this code:

	if (!MONO_TYPE_IS_VECTOR_PRIMITIVE (etype)) {
		// Happens often in gshared code
		if (mini_type_get_underlying_type (etype)->type == MONO_TYPE_OBJECT) {
			if (id == SN_get_IsSupported) {
				MonoInst *ins = NULL;
				EMIT_NEW_ICONST (cfg, ins, 0);
				if (cfg->verbose_level > 1)
					printf ("  -> %d\n", (int)ins->inst_c0);
				return ins;
			}
		}

		return NULL;
	}

So the IsSupported call is not intrinsified, so it will fall back to the managed implementation which does the right thing.

The perf regression is some other issue which is also fixed with this change.

@vargaz vargaz merged commit 2756c94 into dotnet:main Feb 20, 2024
127 checks passed
@vargaz vargaz deleted the fix-wasm-regress branch February 20, 2024 19:35
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants