Skip to content

What command does write_bitcode execute? #821

Open
@zcfh

Description

@zcfh

❓ Questions and Help

import gym
bench = make_benchmark("path/to/file.bc")
env2 = gym.make("llvm-autophase-ic-v0", benchmark=bench, reward_space="IrInstructionCountO3")
env2.reset()
env2.write_bitcode("path/to/out.bc")

For env that has not executed any action, call write_bitcode directly. The generated bitcode is different from the original bitcode. I want to know what happened during this period? Was opt executed again?
I set COMPILER_GYM_DEBUG=99. According to the log, it seems that the first time llvm::parseBitcodeFile(83068 bits) loaded the original bitcode, and then llvm::parseBitcodeFile(77648) was executed again without performing any operations. bitcode, here is the last written bitcode, but I haven’t found where it is called.

Additional Context

I1016 20:41:39.214298 14281 CompilerGymServiceImpl.h:192] AddBenchmark()
I1016 20:41:39.214318 14281 BenchmarkCache.cc:54] Cached benchmark benchmark://file-v0/home/relay/wuminghui03/workspace/ppo/ppo_compiler_gym_clang10/bzip2/build_ppo_to_obj/bzip2.c.ori.bc (83197 bytes). Cache size = 83197 bytes, 1 items
I1016 20:41:39.214601 14256 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://file-v0/home/xxx/workspace/ppo/ppo_compiler_gym_clang10/bzip2/build_ppo_to_obj/bzip2.c.ori.bc), 1 active sessions
I1016 20:41:39.214673 14256 BenchmarkFactory.cc:41] BenchmarkFactory initialized
I1016 20:41:39.214681 14256 BenchmarkFactory.cc:68] LLVM benchmark cache miss, add bitcode: benchmark://file-v0/home/xxx/workspace/ppo/ppo_compiler_gym_clang10/bzip2/build_ppo_to_obj/bzip2.c.ori.bc
I1016 20:41:39.214809 14256 Benchmark.cc:106] llvm::parseBitcodeFile(83068 bits)
I1016 20:41:47.993764 14256 BenchmarkFactory.cc:143] Cached LLVM benchmark: benchmark://file-v0/home/xxx/workspace/ppo/ppo_compiler_gym_clang10/bzip2/build_ppo_to_obj/bzip2.c.ori.bc. Cache size = 1 items
I1016 20:41:47.993835 14256 BenchmarkFactory.cc:59] LLVM benchmark cache hit: benchmark://file-v0/home/xxx/workspace/ppo/ppo_compiler_gym_clang10/bzip2/build_ppo_to_obj/bzip2.c.ori.bc
I1016 20:41:48.035897 14256 Benchmark.cc:106] llvm::parseBitcodeFile(77648 bits)

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions