How to execute the generated bitcode?
See original GitHub issue❓ Questions and Help
I was wondering if there was a standard api in compiler gym to run executed bitcode?
For example if I have the following environment
env = gym.make("llvm-autophase-ic-v0")
env.require_datasets(['cBench-v0'])
And go to the directory containing the datasets bitcode files, try to run one with
lli bitcount.bc
which seg faults - I tried a few other programs and got undefined reference to main. My question is if there is a common way to run these packaged dataset programs pre and post compiler transformations to be able to compute rewards from speedup.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Bitcode and Assembly? | Apple Developer Forums
When using Xcode, bitcode is only produced during archive build, ... Assembly source files should work in the sense that you can build...
Read more >Understanding Bitcode for iOS Applications - InfoQ
These can be passed to the Swift compiler with -embed-bitcode or by using clang with -fembed-bitcode .
Read more >How to run LLVM bitcode generated from Haskell source code
I'm trying to run LLVM bitcode generated from Haskell source code instead of compiling the code to a native binary on macOS.
Read more >Xcode Build Settings
Run Script build phases can use the value of this build setting as a ... For Archive builds, bitcode will be generated in...
Read more >iOS Symbolication - Visual Studio App Center | Microsoft Learn
The body of the first API call should set symbol_type to Apple . ... If Bitcode is enabled, the symbols generated for your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello again!
I have been busy recently but have slowly been working on using ck to create datasets to use within compiler gym and thought I’d give an update as well as a follow up question related to creating datasets in compiler gym.
So with ck, each program has its own meta.json file essentially describing all of the dependencies to compile and run the program, as well as compile and run options and tags like ‘cbench,program,benchmark’ that can be used to find groups of programs with the same tags.
I went with using this functionality to create a list of benchmarks to be used by passing a tag. For example
ck run cg-program:dqn --dataset_tags=cbench
will run the compiler gym dqn I already had but will use ck programs with tags ‘cbench’ as the benchmarks it learns from.This leaves me to my question about the benchmarks - Right now I find all the programs in ck with the specified tags, compile them to make sure they compile with the ck api, and then for each ck program (which may consist of a list of bc files), I call env.make_benchmark(). I store each of these benchmarks in a list but cannot set env.benchmarks to this list so instead I just randomly select a benchmark and pass that benchmark into env.reset().
I was wondering if this env.benchmark is stored in the same location as the original bitcode file and if the env.step() would then apply whichever action that was selected to all of the bitcode files that are part of the current benchmark.
Thanks and I can give you a link to the code if that helps!
Hi @phesse001, thanks for the update! This sounds like great progress.
Is the goal to have one benchmark per cBench program? If so, you can pass all of the bitcodes that comprise that program into
env.make_benchmark()
to produce a single benchmark:Under the covers, this is equivalent to using llvm-link to join the bitcodes:
This resulting benchmark can be linked to an executable as-per the described flags in cBench meta.json.
No, the object created by
env.make_benchmark()
is independent of the filesystem. If you printed one of the return values you can see that it is an in-memory store of the bitcode as a string.Hope that helps. Please feel free to ping me at chrisc.101@gmail.com if you want to set up a quick video chat, always nice to connect with fellow compiler researchers 😃
Cheers, Chris