Skip to content

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

Merged
vargaz merged 1 commit into
dotnet:mainfrom
vargaz:fix-wasm-regress
Feb 20, 2024
Merged

[mono][wasm] Fix a performance regression introduced by #97096.#98515
vargaz merged 1 commit into
dotnet:mainfrom
vargaz:fix-wasm-regress

Conversation

@vargaz

@vargaz vargaz commented Feb 15, 2024

Copy link
Copy Markdown
Contributor

No description provided.

@vargaz

vargaz commented Feb 15, 2024

Copy link
Copy Markdown
Contributor Author

@radekdoulik

@ghost ghost assigned vargaz Feb 15, 2024
@vargaz

vargaz commented Feb 15, 2024

Copy link
Copy Markdown
Contributor Author

/azp run runtime-wasm

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@vargaz

vargaz commented Feb 15, 2024

Copy link
Copy Markdown
Contributor Author

Fixes #98522.

@lateralusX

Copy link
Copy Markdown
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

vargaz commented Feb 16, 2024

Copy link
Copy Markdown
Contributor Author

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

lateralusX commented Feb 16, 2024

Copy link
Copy Markdown
Member

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

vargaz commented Feb 16, 2024

Copy link
Copy Markdown
Contributor Author

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.

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