Skip to content

add/improve atomic yields for SSE2, ARM*, PowerPC#350

Merged
daanx merged 1 commit intomicrosoft:devfrom
mr-c:patch-1
Jan 29, 2021
Merged

add/improve atomic yields for SSE2, ARM*, PowerPC#350
daanx merged 1 commit intomicrosoft:devfrom
mr-c:patch-1

Conversation

@mr-c
Copy link
Copy Markdown
Contributor

@mr-c mr-c commented Jan 23, 2021

No description provided.

@ghost
Copy link
Copy Markdown

ghost commented Jan 23, 2021

CLA assistant check
All CLA requirements met.

rpavlik referenced this pull request Jan 26, 2021
adding clobber for ARM and preventing older 32 bits chips not supporting this instruction.
@rpavlik
Copy link
Copy Markdown

rpavlik commented Jan 26, 2021

I'd like to encourage this to be merged: it fixed the armel build of SolveSpace on Debian, and we'd like to just update to a new upstream version rather than carrying this patch ourselves.

@devnexen
Copy link
Copy Markdown
Contributor

devnexen commented Jan 27, 2021

Interesting. Is there any benchmark for the arm64 case (cpu usage, performance)?

@mr-c
Copy link
Copy Markdown
Contributor Author

mr-c commented Jan 27, 2021

Interesting. Is there any benchmark for the arm64 case (cpu usage, performance)?

I don't have benchmarks, but the wfe instruction is how the Linux kernel does atomic yields for their spinlocks (arch_spin_lock) on arm64, arm 32v7, and arm 32v6 with k extension

https://sources.debian.org/src/linux/5.10.9-1/arch/arm/include/asm/spinlock.h/?hl=36#L74

the arm64 definition of the wfe alias is https://sources.debian.org/src/linux/5.10.9-1/arch/arm64/include/asm/barrier.h/?hl=18#L18

#define wfe() asm volatile("wfe" : : : "memory")

and the arm (32-bits) definition of the wfe alias is https://sources.debian.org/src/linux/5.10.9-1/arch/arm/include/asm/barrier.h/?hl=18#L12

#define wfe() __asm__ __volatile__ ("wfe" : : : "memory")

@devnexen
Copy link
Copy Markdown
Contributor

devnexen commented Jan 27, 2021

true even tough bit_spin_lock, thus cpu_relax use yield on arm64 thus why I was curious about benefits (outcome might differ b/w mono vs multi thread context as well).

Note : I genuinely hope your suggestions are beneficial, it is just to have some background.

@rpavlik
Copy link
Copy Markdown

rpavlik commented Jan 27, 2021

If nothing else, the commit distinguishing versions of ARM in the dev branch were needed to fix armel builds in Debian. Is there a timeline for an upcoming release from dev?

@vespakoen
Copy link
Copy Markdown

There is one ( too many in this PR

I think:

(defined(__x86_64__) || defined(__i386__) || (defined(__arm__) || defined(__armel__) || defined(__ARMEL__) || defined(__aarch64__) || defined(__powerpc__) || defined(__ppc__) || defined(__PPC__))

Was intended to be:

(defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__armel__) || defined(__ARMEL__) || defined(__aarch64__) || defined(__powerpc__) || defined(__ppc__) || defined(__PPC__))

Diff for clarity:

- (defined(__x86_64__) || defined(__i386__) || (defined(__arm__) || defined(__armel__) || defined(__ARMEL__) || defined(__aarch64__) || defined(__powerpc__) || defined(__ppc__) || defined(__PPC__))
+ (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__armel__) || defined(__ARMEL__) || defined(__aarch64__) || defined(__powerpc__) || defined(__ppc__) || defined(__PPC__))

@daanx
Copy link
Copy Markdown
Collaborator

daanx commented Jan 29, 2021

@rpavlik: I will merge this now into dev (and fix the extra parenthesis @vespakoen -- thanks!). The plan is to release soon a new version based on dev, and then soon after a new version based on dev-slice. I hope to release a new master with a week depending on how things go.

@daanx daanx merged commit d9ae916 into microsoft:dev Jan 29, 2021
daanx added a commit that referenced this pull request Jan 29, 2021
@rpavlik
Copy link
Copy Markdown

rpavlik commented Jan 29, 2021

great, thanks!

@mr-c mr-c deleted the patch-1 branch January 29, 2021 07:41
@mr-c
Copy link
Copy Markdown
Contributor Author

mr-c commented Jan 29, 2021

Thanks, all!

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.

5 participants