ROCm / ROCm-OpenCL-Driver

ROCm OpenCL Compiler Tool Driver
MIT License
24 stars 9 forks source link

[asm][in-process] Implement assembling in-process #56

Closed emankov closed 6 years ago

emankov commented 6 years ago

P.S. export AMD_OCL_IN_PROCESS=0 disables in-process for all compilation/linking routines, including assembling.

kasaurov commented 6 years ago

I have two comments/suggestions regarding general in-process design: -- LLVMArgs method of clang::FrontendOptions is used in AMDGPUCompiler::PrepareCompiler() to parse the options, but LLVM docs consider it as a method which "should only be used for debugging and experimental features". Perhaps it'd be great to avoid its usage if possible for stability reasons. -- At the moment OpenCL driver analyzes the jobs created by the tool chain and based on that emits actions directly (discarding the ones created by the tool chain), it would be much more robust to use AMDGPUToolChain to emit all the necessary actions. Of course it is a complex and separate task, not a target goal of this asm in-process commit.

emankov commented 6 years ago

Yes, I've tested locally an opencl application in 4 modes: asm/cl in-process/fork with dumping all intermediate files, printing log, and successfully running the application.

emankov commented 6 years ago

-- LLVMArgs method of clang::FrontendOptions is used in AMDGPUCompiler::PrepareCompiler() to parse the options, but LLVM docs consider it as a method which "should only be used for debugging and experimental features". Perhaps it'd be great to avoid its usage if possible for stability reasons.

These options come to OpenCL-Rocm-Driver from Rocm Runtime and are used in our backend. From LLVM's point of view their usage is experimental, from our backend's point of view - is not, it is the only way to tell to backend an AMD specific options (like -amdgpu-early-inline-all, -amdgpu-prelink and -amdgpu-internalize-symbols). And there is nothing to do with it in OpenCL-Rocm-Driver - it should transfer them.

emankov commented 6 years ago

-- At the moment OpenCL driver analyzes the jobs created by the tool chain and based on that emits actions directly (discarding the ones created by the tool chain), it would be much more robust to use AMDGPUToolChain to emit all the necessary actions. Of course it is a complex and separate task, not a target goal of this asm in-process commit.

Yes, you right. AMDGPUToolChain in clang is definitely a separate task.