Skip to content

Conversation

@dvicini
Copy link
Member

@dvicini dvicini commented Jul 28, 2023

The profile_tasksvariable is currently not thread local. This is in conflict with its use in drjit-core: There it is set within jitc_set_flags, which can be called from multiple threads. All the drjit-core flags are therefore thread local. This commit makes the profile_tasks variable thread local to be consistent with the way flags are handled in drjit-core.

@dvicini dvicini requested a review from wjakob July 28, 2023 14:12
@wjakob
Copy link
Member

wjakob commented Jul 29, 2023

Accessing TLS variables has a shockingly high cost on some OSes. I can look at this after getting back from vacation, but my gut feeling is that we don't want TLS reads in a perf-sensitive threading library.

@dvicini
Copy link
Member Author

dvicini commented Jul 29, 2023

I see, yes it's good to be cautious. We don't want to have a performance cost for this.

As you probably guessed, the reason I am fixing this is because our (latest) threading sanitizer caught the potential race condition in accessing this variable. I am always happy to push back fixes to the open source version, but only if they don't worsen the public code obviously :)

@wjakob wjakob force-pushed the master branch 3 times, most recently from 7bfbde5 to 9d8b8bd Compare February 2, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants