Skip to content
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

Add support for loading binary translated DLLs in MinGW #137

Merged
merged 2 commits into from
Jun 1, 2024

Conversation

fwsGonzo
Copy link
Owner

@fwsGonzo fwsGonzo commented Jun 1, 2024

This is the initial support for loading binary translation DLLs on Windows. #136

$ VERBOSE=1 wine64 rvlinux.exe ../../binaries/stream-rv64gc 
0034:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
0034:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
005c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
005c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
0064:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
0064:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
006c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
006c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
002c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
002c:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
00bc:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
00bc:fixme:font:get_name_record_codepage encoding 20 not handled, platform 1.
* Loading program of size 399580 from 00000000006c7380 to virtual 0000000000010000
* Program segment readable: 1 writable: 0  executable: 1
* Loading program of size 22144 from 00000000007290e0 to virtual 0000000000072d60
* Program segment readable: 1 writable: 1  executable: 0
* Entry is at 0000000000010a50
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 10000000 (elements), Offset = 0 (elements)
Memory per array = 76.3 MiB (= 0.1 GiB).
Total memory required = 228.9 MiB (= 0.2 GiB).
Each kernel will be executed 10 times.
 The *best* time for each kernel (excluding the first iteration)
 will be used to compute the reported bandwidth.
-------------------------------------------------------------
Your clock granularity/precision appears to be 1 microseconds.
Each test below will take on the order of 7691 microseconds.
   (= 7691 clock ticks)
Increase the size of the arrays if this shows that
you are not getting at least 20 clock ticks per test.
-------------------------------------------------------------
WARNING -- The above is only a rough guideline.
For best results, please be sure you know the
precision of your system timer.
-------------------------------------------------------------
Function    Best Rate MB/s  Avg time     Min time     Max time
Copy:           25910.9     0.006192     0.006175     0.006210
Scale:          13175.2     0.012379     0.012144     0.012620
Add:            17040.6     0.014267     0.014084     0.014333
Triad:          15944.7     0.015082     0.015052     0.015143
-------------------------------------------------------------
Solution Validates: avg error less than 1.000000e-13 on all three arrays
-------------------------------------------------------------
>>> Program exited, exit code = 0 (0x0)
Instructions executed: 2787575735  Runtime: 530.769ms  Insn/s: 5252mi/s
Pages in use: 110 (440 kB virtual memory, total 1767 kB)

The way it works now is that MachineOptions has settings related to MinGW compilation on Linux (or rather, non-windows) systems where there is an expectation that you have a compiler in PATH.
Constructing options.mingw_options will by default use x86_64-w64-mingw32-gcc as compiler. It will by default produce a rvbintr-HASH.dll in the build folder when a new program is translated.
Using this we can package them with the script programs, load them on-demand, and get a free ~15x increase in performance for the sandboxed code.

@fwsGonzo fwsGonzo merged commit 08b5898 into master Jun 1, 2024
17 checks passed
@fwsGonzo fwsGonzo deleted the bintr_mingw branch June 1, 2024 19:35
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.

None yet

1 participant