Disruptor-cpp icon indicating copy to clipboard operation
Disruptor-cpp copied to clipboard

Error: unknown mnemonic `rep' -- `rep' on arrch64

Open RomanShestakov opened this issue 2 years ago • 7 comments

hello !

this is very nice and useful project thank you for making it available.

Sadly it doesn't build on aarch64 architecture (mac M1) as it replies on some assembly instructions which are not supported.

e.g

$ make Scanning dependencies of target DisruptorStatic [ 2%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/BasicExecutor.cpp.o [ 4%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/BlockingWaitStrategy.cpp.o [ 6%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/BusySpinWaitStrategy.cpp.o [ 9%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/FixedSequenceGroup.cpp.o [ 11%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/ProcessingSequenceBarrier.cpp.o [ 13%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/ProducerType.cpp.o [ 15%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/RoundRobinThreadAffinedTaskScheduler.cpp.o [ 18%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/Sequence.cpp.o [ 20%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/SequenceGroups.cpp.o [ 22%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/SleepingWaitStrategy.cpp.o [ 25%] Building CXX object Disruptor/CMakeFiles/DisruptorStatic.dir/SpinWait.cpp.o /tmp/ccVC3BXq.s: Assembler messages: /tmp/ccVC3BXq.s:119: Error: unknown mnemonic rep' -- rep' /tmp/ccVC3BXq.s:220: Error: unknown mnemonic rep' -- rep' /tmp/ccVC3BXq.s:241: Error: unknown mnemonic rep' -- rep' make[2]: *** [Disruptor/CMakeFiles/DisruptorStatic.dir/build.make:193: Disruptor/CMakeFiles/DisruptorStatic.dir/SpinWait.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:152: Disruptor/CMakeFiles/DisruptorStatic.dir/all] Error 2 make: *** [Makefile:163: all] Error 2

I don't expect you to fix this as you obviously made this implementation for your use case with low latency in mind - though may be you could still consider adding a similar fix as in this similar case?

https://github.com/nats-io/nats.c/issues/87

Regards, Roman

RomanShestakov avatar Jul 24 '22 20:07 RomanShestakov

I've added a yield version for arm arch. See commit: https://github.com/Abc-Arbitrage/Disruptor-cpp/commit/5cb15ddd9153fa173b77d87f35bad846bd158b3e Note that I don't have arm based computer at my disposal to test the solution, so please let me know if it solves your issue.

Andreone avatar Aug 02 '22 10:08 Andreone

thank you very much for checking - do you think it is possible to use more generic std::this_thread::yield() in this case?

https://en.cppreference.com/w/cpp/thread/yield

Regards, Roman

RomanShestakov avatar Aug 02 '22 19:08 RomanShestakov

I added the following VAR to CMakefile add_compile_definitions(DISRUPTOR_CPU_ARM=1)

and with your change the project compiles ok

thank you very much!

RomanShestakov avatar Aug 02 '22 20:08 RomanShestakov

Good idea. I've added DISRUPTOR_STD_YIELD. This takes precedence over other implementations.

I added the following VAR to CMakefile add_compile_definitions(DISRUPTOR_CPU_ARM=1) This shouldn't be required. The arm branch should have been enabled. This means that neither arm nor aarch64 is set.

Andreone avatar Aug 02 '22 21:08 Andreone

very nice! thank you

but how is DISRUPTOR_STD_YIELD supposed to be set? as part of cmake command?

RomanShestakov avatar Aug 03 '22 07:08 RomanShestakov

Add add_compile_definitions(DISRUPTOR_STD_YIELD) into the CMakeLists.txt or set it when you invoke cmake: cmake -DDISRUPTOR_STD_YIELD path/to/src

Andreone avatar Aug 03 '22 19:08 Andreone

Add add_compile_definitions(DISRUPTOR_STD_YIELD) into the CMakeLists.txt or set it when you invoke cmake: cmake -DDISRUPTOR_STD_YIELD path/to/src

thank you!

RomanShestakov avatar Aug 05 '22 20:08 RomanShestakov