-
Notifications
You must be signed in to change notification settings - Fork 5k
Are !UseThreadAllocationContexts branches relevant? #115102
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
Comments
Tagging subscribers to this area: @mangod9 |
I was looking at JIT_Box for HMF removal and found that JIT_Box variants:
If UseThreadAllocationContexts is not relevant, we can start by cleaning that up as part of JIT_Box non-HMF implementation. cc @jkotas, @filipnavara |
Global allocation context allows to avoid slow TLS loads in allocators (workstation gc, low/single number of cpu cores). It would make sense to benchmark it for docker/linux where it's a popular case when just 1 cpu core is assigned, but the current logic only supports Windows. |
This is a question for @dotnet/gc. They wanted to keep this special path alive in the past. |
Tagging subscribers to this area: @dotnet/gc |
Purely from the support perspective: Windows 10 is the last version of Windows to support uniprocessor and it goes out of support on October 14, 2025. Last Intel single-core processor was Celeron G4xx released in 2013. The code paths don't seem to trigger for containers restricted to single processor. That's basically the only use case where I would consider this relevant. Then again, that's more relevant on Linux where we currently don't have this code path enabled. I'm a bit torn on this. As @EgorBo said, it would be interesting to see if this makes any difference for containers but that's a separate effort... |
This path requires 1 affinitized core assigned. The popular docker case is 1 non-affinitized core assigned. This special path is not usable for that. |
I don't see much good reasons to keep x86 special. |
That is one possibility, and while at it, we can replace Alternatively.. |
Sounds reasonable to me. It will take some effort and benchmarking but I don't expect the code to be too dissimilar to |
Initial implementation: main...am11:runtime:feature/HMF-removal/JIT_Box Currently throws: $ pushd src/libraries/System.Collections/tests
$ ../../../../dotnet.sh build -t:Test
...
===========================================================================================================
~/projects/runtime4/artifacts/bin/System.Collections.Tests/Debug/net10.0 ~/projects/runtime4/src/libraries/System.Collections/tests
Discovering: System.Collections.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Collections.Tests (found 7096 of 9184 test cases)
Starting: System.Collections.Tests (parallel test collections = on [10 threads], stop on fail = off)
[createdump] Gathering state for process 87021
[createdump] Crashing thread d809ecd signal 11 (000b)
[createdump] Writing crash report to file /coredump.87021.dmp.crashreport.json
[createdump] Could not create json file '/coredump.87021.dmp.crashreport.json': Read-only file system (30)
[createdump] Writing minidump with heap to file /coredump.87021.dmp
[createdump] Target process is alive
[createdump] Could not create output file '/coredump.87021.dmp': Read-only file system (30)
[createdump] Failure took 1470ms
waitpid() returned successfully (wstatus 0000ff00) WEXITSTATUS ff WTERMSIG 0
/Users/adeel/projects/runtime4/artifacts/bin/System.Collections.Tests/Debug/net10.0/RunTests.sh: line 178: 87021 Segmentation fault: 11 "$RUNTIME_PATH/dotnet" exec --runtimeconfig System.Collections.Tests.runtimeconfig.json --depsfile System.Collections.Tests.deps.json /Users/adeel/.nuget/packages/microsoft.dotnet.xunitconsolerunner/2.9.2-beta.25225.102/build/../tools/net/xunit.console.dll System.Collections.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing $RSP_FILE Also, for fast alloc, we would need to figure out if we can expose thread local |
I wonder if we don't need it at all given jit knows how to inline boxing as is (but does it only in tier1), we just need to make it always-expand probably.
We probably can, but the whole allocator has to be marked as nogc somehow.. |
That would be cleaner. We can then delete getBoxHelper and JIT_Box helpers similar to https://github.com/dotnet/runtime/pull/114754/files. :) |
Can we measure the Tier0 JIT throughput and code size regression from doing this? Are there are pathological cases where this can generate a lot of new temps? |
At the same time, we unroll copies even in tier0 and unlike the helper, in JIT we always know the size of the object. But hard to say without measurements |
#115134 is testing to see the impact. |
From a usage perspective, here is relatively recent case where customer is still using x86 single core back in 2022. I can't remember where did the dump come from - probably internal given I could not share at that point. |
s_useThreadAllocationContexts
is ever false for win-x86/x64 and single processor:runtime/src/coreclr/vm/gcheaputilities.cpp
Line 376 in 0682b04
In some places they have specialized optimizations, e.g. this win-x64 only branch:
runtime/src/coreclr/vm/jitinterfacegen.cpp
Lines 85 to 98 in 0682b04
Are these relevant? If not, we can delete these paths.
The text was updated successfully, but these errors were encountered: