mirror of
				https://git.wownero.com/wownero/RandomWOW.git
				synced 2024-08-15 00:23:14 +00:00 
			
		
		
		
	Merge branch 'master' into pr-randomx-v2
This commit is contained in:
		
						commit
						b89deae92e
					
				
					 9 changed files with 257 additions and 16 deletions
				
			
		
							
								
								
									
										223
									
								
								.github/workflows/c-cpp.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										223
									
								
								.github/workflows/c-cpp.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,223 @@ | |||
| name: C/C++ CI | ||||
| 
 | ||||
| on: [push, pull_request] | ||||
| 
 | ||||
| jobs: | ||||
|   build-alpine: | ||||
| 
 | ||||
|     timeout-minutes: 15 | ||||
|     runs-on: ubuntu-22.04 | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         config: | ||||
|           - {arch: x86_64, branch: latest-stable} | ||||
|           - {arch: x86, branch: latest-stable} | ||||
|           - {arch: aarch64, branch: latest-stable} | ||||
|           - {arch: armhf, branch: latest-stable} | ||||
|           - {arch: armv7, branch: latest-stable} | ||||
|           - {arch: ppc64le, branch: latest-stable} | ||||
|           - {arch: riscv64, branch: edge} | ||||
|           - {arch: s390x, branch: latest-stable} | ||||
| 
 | ||||
|     steps: | ||||
|     - name: Setup Alpine Linux | ||||
|       uses: jirutka/setup-alpine@v1 | ||||
|       with: | ||||
|         arch: ${{ matrix.config.arch }} | ||||
|         branch: ${{ matrix.config.branch }} | ||||
| 
 | ||||
|     - name: Install dependencies | ||||
|       shell: alpine.sh --root {0} | ||||
|       run: | | ||||
|         apk add git cmake gcc g++ make | ||||
| 
 | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v3 | ||||
|       with: | ||||
|         submodules: true | ||||
| 
 | ||||
|     - name: Build RandomX | ||||
|       shell: alpine.sh {0} | ||||
|       run: | | ||||
|         mkdir build | ||||
|         cd build | ||||
|         cmake .. | ||||
|         make -j$(nproc) | ||||
| 
 | ||||
|     - name: Run tests | ||||
|       shell: alpine.sh {0} | ||||
|       run: | | ||||
|         build/randomx-tests | ||||
| 
 | ||||
|   build-ubuntu: | ||||
| 
 | ||||
|     timeout-minutes: 5 | ||||
|     runs-on: ${{ matrix.config.os }} | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         config: | ||||
|           - {os: ubuntu-20.04, c: gcc-11, cpp: g++-11} | ||||
|           - {os: ubuntu-22.04, c: gcc-12, cpp: g++-12} | ||||
| 
 | ||||
|     steps: | ||||
|     - name: Install dependencies | ||||
|       run: | | ||||
|         sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||||
|         sudo apt update | ||||
|         sudo apt install -y git build-essential cmake ${{ matrix.config.c }} ${{ matrix.config.cpp }} | ||||
| 
 | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v3 | ||||
|       with: | ||||
|         submodules: true | ||||
| 
 | ||||
|     - name: Build RandomX | ||||
|       run: | | ||||
|         mkdir build | ||||
|         cd build | ||||
|         cmake .. | ||||
|         make -j$(nproc) | ||||
| 
 | ||||
|     - name: Run tests | ||||
|       run: | | ||||
|         build/randomx-tests | ||||
| 
 | ||||
|   build-windows-msys2: | ||||
| 
 | ||||
|     timeout-minutes: 15 | ||||
|     runs-on: windows-latest | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         config: | ||||
|           - {c: "gcc", cxx: "g++"} | ||||
|           - {c: "clang", cxx: "clang++"} | ||||
| 
 | ||||
|     defaults: | ||||
|       run: | ||||
|         shell: msys2 {0} | ||||
| 
 | ||||
|     steps: | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v3 | ||||
|       with: | ||||
|         submodules: recursive | ||||
| 
 | ||||
|     - name: Setup MSYS2 | ||||
|       uses: eine/setup-msys2@v2 | ||||
|       with: | ||||
|         update: true | ||||
|         install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make | ||||
| 
 | ||||
|     - name: Build RandomX | ||||
|       run: | | ||||
|         mkdir build | ||||
|         cd build | ||||
|         cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} | ||||
|         make -j$(nproc) | ||||
| 
 | ||||
|     - name: Run tests | ||||
|       run: | | ||||
|         build/randomx-tests.exe | ||||
| 
 | ||||
|   build-windows-msbuild: | ||||
| 
 | ||||
|     timeout-minutes: 5 | ||||
|     runs-on: windows-${{ matrix.config.os }} | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         config: | ||||
|           - {arch: x64, os: 2019, vs: Visual Studio 16 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\"} | ||||
|           - {arch: x64, os: 2022, vs: Visual Studio 17 2022, msbuild: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\"} | ||||
|           - {arch: Win32, os: 2019, vs: Visual Studio 16 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\"} | ||||
|           - {arch: Win32, os: 2022, vs: Visual Studio 17 2022, msbuild: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\"} | ||||
| 
 | ||||
|     steps: | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v3 | ||||
|       with: | ||||
|         submodules: recursive | ||||
| 
 | ||||
|     - name: Setup cmake | ||||
|       uses: lukka/get-cmake@latest | ||||
| 
 | ||||
|     - name: Build RandomX | ||||
|       run: | | ||||
|         mkdir build | ||||
|         cd build | ||||
|         cmake .. -G "${{ matrix.config.vs }}" -A ${{ matrix.config.arch }} | ||||
|         & "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release randomx-tests.vcxproj | ||||
| 
 | ||||
|     - name: Run tests | ||||
|       run: | | ||||
|         build/Release/randomx-tests.exe | ||||
| 
 | ||||
|   build-macos: | ||||
| 
 | ||||
|     timeout-minutes: 5 | ||||
|     runs-on: ${{ matrix.os }} | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         os: [macos-11, macos-12, macos-13] | ||||
| 
 | ||||
|     steps: | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v3 | ||||
|       with: | ||||
|         submodules: recursive | ||||
| 
 | ||||
|     - name: Install dependencies | ||||
|       run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake | ||||
| 
 | ||||
|     - name: Build RandomX | ||||
|       run: | | ||||
|         mkdir build | ||||
|         cd build | ||||
|         cmake .. | ||||
|         make -j3 | ||||
| 
 | ||||
|     - name: Run tests | ||||
|       run: | | ||||
|         build/randomx-tests | ||||
| 
 | ||||
|   build-freebsd: | ||||
| 
 | ||||
|     timeout-minutes: 15 | ||||
|     runs-on: ${{ matrix.os.host }} | ||||
| 
 | ||||
|     strategy: | ||||
|       matrix: | ||||
|         os: | ||||
|           - name: freebsd | ||||
|             architecture: x86-64 | ||||
|             version: '13.2' | ||||
|             host: ubuntu-22.04 | ||||
| 
 | ||||
|           - name: freebsd | ||||
|             architecture: arm64 | ||||
|             version: '13.2' | ||||
|             host: ubuntu-22.04 | ||||
| 
 | ||||
|     steps: | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v3 | ||||
|       with: | ||||
|         submodules: recursive | ||||
| 
 | ||||
|     - name: Build RandomX | ||||
|       uses: cross-platform-actions/action@v0.19.0 | ||||
|       with: | ||||
|         operating_system: ${{ matrix.os.name }} | ||||
|         architecture: ${{ matrix.os.architecture }} | ||||
|         version: ${{ matrix.os.version }} | ||||
|         shell: bash | ||||
|         run: | | ||||
|           sudo pkg install -y cmake | ||||
|           mkdir build && cd build | ||||
|           cmake .. | ||||
|           make -j2 | ||||
|           ./randomx-tests | ||||
|  | @ -96,7 +96,7 @@ function(add_flag flag) | |||
| endfunction() | ||||
| 
 | ||||
| # x86-64 | ||||
| if(ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64") | ||||
| if ((CMAKE_SIZEOF_VOID_P EQUAL 8) AND (ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64")) | ||||
|   list(APPEND randomx_sources | ||||
|     src/jit_compiler_x86.cpp) | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,13 +1,13 @@ | |||
| -----BEGIN PGP PUBLIC KEY BLOCK----- | ||||
| 
 | ||||
| mDMEXd+PeBYJKwYBBAHaRw8BAQdAZ0nqJ+nRYoScG2QLX62pl+WO1+Mkv6Yyt2Kb | ||||
| ntGUuLq0G3RldmFkb3IgPHRldmFkb3JAZ21haWwuY29tPoiWBBMWCAA+FiEEMoWj | ||||
| LVEwdmMs6CUQWijIaue9c6YFAl3fj3gCGwMFCQWnqDgFCwkIBwIGFQoJCAsCBBYC | ||||
| AwECHgECF4AACgkQWijIaue9c6YBFQD+N1XTUqSCZp9jB/yTHQ9ahSaIUMtmuvdT | ||||
| So2s+quudP4A/R5wLwukpfGN9UZ4cfpmKCJ9jO1HJ2udmlGMsJbQpDAIuDgEXd+P | ||||
| ntGUuLq0G3RldmFkb3IgPHRldmFkb3JAZ21haWwuY29tPoiWBBMWCAA+AhsDBQsJ | ||||
| CAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEMoWjLVEwdmMs6CUQWijIaue9c6YFAmRP | ||||
| r8MFCQ/ZS2YACgkQWijIaue9c6bR5gEA0tnQ4Al+yOLoRUBQitAV8FU4FLy8Xx8U | ||||
| IyyivjJ0UhIA/2jwJfMXmJdMKtar8xfIA5mZLLofkEP6hug4knhitpkBuDgEXd+P | ||||
| eBIKKwYBBAGXVQEFAQEHQBNbQuPcDojMCkRb5B5u7Ld/AFLClOh+6ElL+u61rIY/ | ||||
| AwEIB4h+BBgWCAAmFiEEMoWjLVEwdmMs6CUQWijIaue9c6YFAl3fj3gCGwwFCQWn | ||||
| qDgACgkQWijIaue9c6YJvgD+IY1Q9mCM1P1iZIoXuafRihXJ7UgVXpQqW2yoaUT3 | ||||
| bfQA/RkisI2eElYoOjdwPszPP6VfL5+SViwDmDuJG2P5llgE | ||||
| =V4vd | ||||
| -----END PGP PUBLIC KEY BLOCK----- | ||||
| AwEIB4h+BBgWCAAmAhsMFiEEMoWjLVEwdmMs6CUQWijIaue9c6YFAmRQoAMFCQ/Z | ||||
| S2YACgkQWijIaue9c6bUfwD9Hw20kGCaZ8rWghz9W3bc645ys1vPQpQW28CD9w3B | ||||
| cTMBALsV1xpS2pGwTfn1PUimqESZfTrREmNvOjKSQwe0yicI | ||||
| =D4lm | ||||
| -----END PGP PUBLIC KEY BLOCK----- | ||||
|  | @ -36,7 +36,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| #include "cpu.hpp" | ||||
| #include <cassert> | ||||
| #include <limits> | ||||
| 
 | ||||
| #if defined(__SSE__) || defined(__SSE2__) || (defined(_M_IX86_FP) && (_M_IX86_FP > 0)) | ||||
| #define USE_CSR_INTRINSICS | ||||
| #include <xmmintrin.h> | ||||
| #else | ||||
| #include <cfenv> | ||||
| #endif | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
|  | @ -356,8 +362,14 @@ extern "C" { | |||
| 		assert(machine != nullptr); | ||||
| 		assert(inputSize == 0 || input != nullptr); | ||||
| 		assert(output != nullptr); | ||||
| 
 | ||||
| #ifdef USE_CSR_INTRINSICS | ||||
| 		const unsigned int fpstate = _mm_getcsr(); | ||||
| #else | ||||
| 		fenv_t fpstate; | ||||
| 		fegetenv(&fpstate); | ||||
| #endif | ||||
| 
 | ||||
| 		alignas(16) uint64_t tempHash[8]; | ||||
| 		int blakeResult = blake2b(tempHash, sizeof(tempHash), input, inputSize, nullptr, 0); | ||||
| 		assert(blakeResult == 0); | ||||
|  | @ -370,7 +382,12 @@ extern "C" { | |||
| 		} | ||||
| 		machine->run(&tempHash); | ||||
| 		machine->getFinalResult(output, RANDOMX_HASH_SIZE); | ||||
| 
 | ||||
| #ifdef USE_CSR_INTRINSICS | ||||
| 		_mm_setcsr(fpstate); | ||||
| #else | ||||
| 		fesetenv(&fpstate); | ||||
| #endif | ||||
| 	} | ||||
| 
 | ||||
| 	void randomx_calculate_hash_first(randomx_vm* machine, const void* input, size_t inputSize) { | ||||
|  |  | |||
|  | @ -32,6 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| #include <cstdlib> | ||||
| #include <iostream> | ||||
| #include <fstream> | ||||
| #include <cstdint> | ||||
| 
 | ||||
| constexpr char hexmap[] = "0123456789abcdef"; | ||||
| inline void outputHex(std::ostream& os, const char* data, int length) { | ||||
|  |  | |||
|  | @ -43,7 +43,7 @@ | |||
|     <ClInclude Include="..\src\superscalar.hpp" /> | ||||
|     <ClInclude Include="..\src\superscalar_program.hpp" /> | ||||
|     <ClInclude Include="..\src\virtual_machine.hpp" /> | ||||
|     <ClInclude Include="..\src\virtual_memory.hpp" /> | ||||
|     <ClInclude Include="..\src\virtual_memory.h" /> | ||||
|     <ClInclude Include="..\src\vm_compiled.hpp" /> | ||||
|     <ClInclude Include="..\src\vm_compiled_light.hpp" /> | ||||
|     <ClInclude Include="..\src\vm_interpreted.hpp" /> | ||||
|  | @ -74,7 +74,7 @@ | |||
|     <ClCompile Include="..\src\soft_aes.cpp" /> | ||||
|     <ClCompile Include="..\src\superscalar.cpp" /> | ||||
|     <ClCompile Include="..\src\virtual_machine.cpp" /> | ||||
|     <ClCompile Include="..\src\virtual_memory.cpp" /> | ||||
|     <ClCompile Include="..\src\virtual_memory.c" /> | ||||
|     <ClCompile Include="..\src\vm_compiled.cpp" /> | ||||
|     <ClCompile Include="..\src\vm_compiled_light.cpp" /> | ||||
|     <ClCompile Include="..\src\vm_interpreted.cpp" /> | ||||
|  |  | |||
|  | @ -87,7 +87,7 @@ | |||
|     <ClInclude Include="..\src\virtual_machine.hpp"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\src\virtual_memory.hpp"> | ||||
|     <ClInclude Include="..\src\virtual_memory.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\src\vm_compiled.hpp"> | ||||
|  | @ -151,7 +151,7 @@ | |||
|     <ClCompile Include="..\src\virtual_machine.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\src\virtual_memory.cpp"> | ||||
|     <ClCompile Include="..\src\virtual_memory.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\src\vm_compiled.cpp"> | ||||
|  |  | |||
|  | @ -198,7 +198,7 @@ SET ERRORLEVEL = 0</Command> | |||
|     <ClInclude Include="..\src\soft_aes.h" /> | ||||
|     <ClInclude Include="..\src\superscalar_program.hpp" /> | ||||
|     <ClInclude Include="..\src\virtual_machine.hpp" /> | ||||
|     <ClInclude Include="..\src\virtual_memory.hpp" /> | ||||
|     <ClInclude Include="..\src\virtual_memory.h" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|  |  | |||
|  | @ -164,7 +164,7 @@ | |||
|     <ClInclude Include="..\src\virtual_machine.hpp"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\src\virtual_memory.hpp"> | ||||
|     <ClInclude Include="..\src\virtual_memory.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\src\superscalar.hpp"> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue