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

JIT input files and code coverage #1736

Open
garyt2 opened this issue Jun 27, 2024 · 4 comments
Open

JIT input files and code coverage #1736

garyt2 opened this issue Jun 27, 2024 · 4 comments

Comments

@garyt2
Copy link

garyt2 commented Jun 27, 2024

Noticed that a sim built with code-coverage flags -fprofile-arcs -ftest-coverage will not run a JIT-input file, it cannot load the generated .so file.

Is there a workaround?

@hchen99
Copy link
Contributor

hchen99 commented Jun 27, 2024

Interesting...will do some testing and get back.

@hchen99
Copy link
Contributor

hchen99 commented Jun 27, 2024

Can give it a try as following:

  • Add -fprofile-arcs -ftest-coverage to .so target in Makefile.input in jitlib directory.
    • Assuming .o target already has-fprofile-arcs -ftest-coverage flags
  • make -f RUN_cpp_input/jitlib/Makefile.input for instance
  • Run sim with a python input file that contains trick.jit_compile_and_run("RUN_cpp_input/input.cpp")

@garyt2
Copy link
Author

garyt2 commented Jun 28, 2024

That is looking like it has potential. Here's the build process that seems to work from a pristine state:

  • build sim with coverage flags
  • run the JIT input file to generate the jitlib folder, this run will fail but will populate the jitlib area.
  • Edit the RUN_xxx/jitlib/Makefile.input_config file to replace:
    • /usr/bin/g++ -shared -o $@ $< with
    • /usr/bin/g++ -shared -fprofile-arcs -ftest-coverage -o $@ $<
  • remove the .so file that was previously generated in the failed run (RUN_xxx/jitlib/libinput_config.so)
  • re-make the .so filemake -f RUN_xxx/jitlib/Makefile.input_config
  • Re-run the sim with the JIT input file.

So that's a bit cumbersome, but it seems that, if the modified Makefile could be copied in instead (in place of the default Makefile) for sims that are compiled with coverage flags, then the necessity to run with expected failure, edit the default Makefile, remove the original .so, and re-make might be avoided.

Is there a way to identify a build-with-coverage, and conditionally identify which Makefile to populate jitlib with?

@hchen99
Copy link
Contributor

hchen99 commented Jun 28, 2024

Yeah, the workaround takes some manual work. Current JIT input code doesn't generate .so target with trick or trick system CXXFLAGS like for .o target and it doesn't check if build-with-coverage. We'll look into this to make needed update such as to update trick code to have coverage flags for .so in jitlib Makefile if jit input is built with coverage.

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

No branches or pull requests

2 participants