-
Notifications
You must be signed in to change notification settings - Fork 23
Enable prefetch on MSVC #70
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
base: unity-master
Are you sure you want to change the base?
Changes from all commits
c704831
f3c778a
81823f1
a84e95a
729106f
d7369af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,10 @@ | |
| #include "gc.h" | ||
| #include "gc_tiny_fl.h" | ||
|
|
||
| # ifdef _MSC_VER | ||
| # include <intrin.h> /* for prefetch intrinsics */ | ||
| # endif | ||
|
|
||
| #if GC_GNUC_PREREQ(3, 0) | ||
| # define GC_EXPECT(expr, outcome) __builtin_expect(expr,outcome) | ||
| /* Equivalent to (expr), but predict that usually (expr)==outcome. */ | ||
|
|
@@ -54,6 +58,8 @@ | |
| #ifndef GC_PREFETCH_FOR_WRITE | ||
| # if GC_GNUC_PREREQ(3, 0) && !defined(GC_NO_PREFETCH_FOR_WRITE) | ||
| # define GC_PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1) | ||
| # elif defined(_MSC_VER) && !defined(GC_NO_PREFETCH_FOR_WRITE) && !defined(_M_ARM) && !defined(_M_ARM64) | ||
| # define GC_PREFETCH_FOR_WRITE(x) _mm_prefetch((x), _MM_HINT_T0) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Work to support WIndows ARM64 recently landed by @jem-patel . Assuming the Mono branch for these prefetch changes has that work, just make sure that platform/arch still builds on CI with these changes. I don't think this intrinsic exists on ARM64. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this file get included in IL2CPP? If so, we need both ARM32 & ARM64 paths as we support those for UWP. If it's only used by Mono, then we need ARM64 path for Windows Standalone. From what I can tell looking at the headers, these intrinsics are available there: I don't know which one(s) we want to use.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My proposal is this
Thoughts? |
||
| # else | ||
| # define GC_PREFETCH_FOR_WRITE(x) (void)0 | ||
| # endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of public headers (like gc_inline.h), it would be better to include additional headers only for the condition which require it, e.g. in this case it could be: !defined(GC_PREFETCH_FOR_WRITE) && !defined(GC_NO_PREFETCH_FOR_WRITE) && defined(_MSC_VER) && (defined(_M_X64) || ...)