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
Cannot assemble correct binary for Polaris 10 #6
Comments
Can you give some failed examples (source code or excerpts)? |
Anything I disassemble with CLRX - the only example I have right now is long, but I could make a simple anything and compile it using the AMDGPU OCL runtime, and then disassemble, reassemble, and try to load it - says failed to load HSA code object. |
Thank you. Can you give me a driver kind and driver version which you are using? I didn't check all devices types given by latest Windows/Linux drivers, so problem can be occurred. |
16.30 AMDGPU drivers - Linux, but since the binaries are cross compatible, I would expect the same from Windows. Polaris 10 (Ellesmere) was my target. |
Thank you for answer. I got this same error while trying to run simple example (GenericPtr and VectorAdd) when OpenCL 2.0 code enabled. clinfo got info that my device (Bonaire) doesn't support OpenCL 2.0 (only OpenCL 1.2 C compiler supported). Check whether AMD GPU PRO supports OpenCL 2.0 for your device. I will be trying to other configs to know how these drivers behaves with CLRX. |
It works with -cl-std=CL2.0, but I can try different options. From what I see in your disassembler's output, it's using 2.0 automatically. |
Few days I ran OpenCL 2.0 example (GenericPtr) on Win 8.1 with latest Crimson 16.9.1 beta drivers. It worked correctly (I was testing older version of CLRX). This is problem only on AMDGPU-PRO driver. |
Answer at https://community.amd.com/thread/205476. AMDGPU-PRO doesn't support OpenCL 2.0. This same info is in Releases Notes:
.... |
So how do I get this to disassemble/assemble as OpenCL 1.2? |
I ran VectorAdd example for OpenCL 1.2 and it works good on AMDGPU-PRO. Just, you can try (without build binaries without option '-cl-std=CL2.0' or force use OpenCL 1.2 '-cl-std=CL1.2'). |
I just forced -cl-std=CL1.2 - and it disassembles as .amdcl2. |
oh.... I forgot about one. New OpenCL drivers just use OpenCL 2.0 format while using OpenCL 1.2. This is normal behaviour (same as later Windows drivers). Thus, the CLRX recognizes stored binaries as .amdcl2. Maybe later, I will find more time to solve this problem. |
I'd be willing to donate, if that would help. I really want the ability to use this for my Polaris GPUs on linux. |
I apologize for my postponed reaction, but I have really urgent task to do, I couldn't properly understand clue of the problem. |
That's okay - some other time. |
I fixed detection AMDGPU-PRO driver while compilation (by adding extra path to AMDOpenCL library). Now, samples (with OpenCL 2.0 format, even with option "-cl-std=CL2.0") works correctly. With latest version CLRX detect an OpenCL libraries in 2117.07 version. However, disassembled codes should be work correctly, because disassembler includes info about driver version '.driver_version 203603'. |
Disassembling a binary made with AMD's OCL runtime (AMDGPU-PRO), and then assembling it produces a binary that, if you attempt to load it with AMD's OCL runtime, it throws this error: [06:19:02] Error -11: Building Program (clBuildProgram) |
Some hint for you: to disassemble code for assemble you should use options -a (--all) and optionally '-C' (-config). like: |
Just tried -aC - did not work. |
Do you check also only '-a' option for clrxdisasm (option '-C' stores kernel configuration in human-readable form, without this option disassembler stores closely this same config as in input file)? |
I just downloaded it from git last night. I'll try only -a. |
This is the binary produced by AMD: https://ottrbutt.com/tmp/ethashEllesmeregw256l8.bin |
Thank you. Very likely CLRX assembler stores incorrectly info about constant data (sections, offset, symbols). If I will find free time I will fix that bug. |
Thank you! |
Ok. Can you do yet another thing? Just write a very simple kernel (like vectorAdd), try to rebuild with CLRX and load via OpenCL runtime. Just check, whether CLRX can correctly rebuild simpliest kernel for the AMDGPU-PRO driver. Just like that:
|
I have some doubts, whether your problems caused by a wrong storing of constant datas by CLRX while building binaries. Can you make simple test described above? |
I have no a RX 480, however I was trying load by runtime (AMDGPUPRO) a delivered (by you) binaries. I modified device (to my Bonaire) type in ELF header (no other changes) on both binaries (CLRX and original). Results are:
I created simple kernel that have this same amount of constant data (192 bytes) and I was trying to load both original binary and regenerated binary (both compiled for Bonaire). Both was loaded successfully by my driver installation. EDIT: I could load (by clBuildProgram) listed above binaries either with "-cl-std=CL1.2", "-cl-std=CL2.0" and without and options. |
Very likely, problem has been fixed. I added a missing arch minor, stepping and set architecture type in '.note' section. Very likely should work with GCN 1.2 code. |
It appears to work! Thank you! |
Since I'm unable to use the LLVM toolchain, this is the only way I can properly work on kernels - it'd be nice to have Polaris 10 support.
The text was updated successfully, but these errors were encountered: