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

Dumping LLVM JIT module to assembly #611

Closed
georgemitenkov opened this issue Apr 23, 2021 · 3 comments · Fixed by #620
Closed

Dumping LLVM JIT module to assembly #611

georgemitenkov opened this issue Apr 23, 2021 · 3 comments · Fixed by #620
Assignees
Labels

Comments

@georgemitenkov
Copy link
Collaborator

Currently, we not see the assembly generated from LLVM IR module when passing it to JIT. We need to find a way (see #592) to verify that the instructions are produced for intended platforms.

@georgemitenkov georgemitenkov self-assigned this Apr 23, 2021
@georgemitenkov
Copy link
Collaborator Author

georgemitenkov commented Apr 23, 2021

Approach 1: Dump to object file and the disassemble

// add line
jit->getObjTransformLayer().setTransform(llvm::orc::DumpObjects("dir", "name"));

then

$ objdump -D test.o

Approach 2:

  • TODO

@pramodk
Copy link
Contributor

pramodk commented Apr 23, 2021

Approach 1 mentioned is already helpful! Based on the API mentioned, I was looking at the example llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp.

@georgemitenkov
Copy link
Collaborator Author

Yes, I was looking at the same example!

georgemitenkov added a commit that referenced this issue Apr 30, 2021
The following is added:

1. Dumping object files in JIT.

A functionality to dump (enabled by default) the generated from LLVM IR file binary to `.o` has been added to benchmarking. Now, in addition to logs, a `v<vector_width>_<mod_filename>.o` is generated. The reasons it is an object file and not an assembly (hence not included in logs) are the following:

- LLVM does not have library functions that take the object and turn back into assembly, but rather `object -> file -> assembly` path. It also has a `llvm-objdump` tool, but it is intended as a command-line utility and does not have a well-defined API.

- Writing custom functions to produce a readable assembly is not a priority. Also, mimicking `objdump` functionality would be difficult.

- Both `objdump` and `llvm-objdump` can be used to isnpect the `.o` file manually.

2. Refactoring of `Runner` class.

In addition to the support of dumping the binary, `Runner`and `JITDriver` classes were refactored to have a nicer OOP-style.

fixes #611

Co-authored-by: Pramod S Kumbhar <[email protected]>
pramodk added a commit that referenced this issue May 8, 2021
The following is added:

1. Dumping object files in JIT.

A functionality to dump (enabled by default) the generated from LLVM IR file binary to `.o` has been added to benchmarking. Now, in addition to logs, a `v<vector_width>_<mod_filename>.o` is generated. The reasons it is an object file and not an assembly (hence not included in logs) are the following:

- LLVM does not have library functions that take the object and turn back into assembly, but rather `object -> file -> assembly` path. It also has a `llvm-objdump` tool, but it is intended as a command-line utility and does not have a well-defined API.

- Writing custom functions to produce a readable assembly is not a priority. Also, mimicking `objdump` functionality would be difficult.

- Both `objdump` and `llvm-objdump` can be used to isnpect the `.o` file manually.

2. Refactoring of `Runner` class.

In addition to the support of dumping the binary, `Runner`and `JITDriver` classes were refactored to have a nicer OOP-style.

fixes #611

Co-authored-by: Pramod S Kumbhar <[email protected]>
pramodk added a commit that referenced this issue Mar 8, 2022
The following is added:

1. Dumping object files in JIT.

A functionality to dump (enabled by default) the generated from LLVM IR file binary to `.o` has been added to benchmarking. Now, in addition to logs, a `v<vector_width>_<mod_filename>.o` is generated. The reasons it is an object file and not an assembly (hence not included in logs) are the following:

- LLVM does not have library functions that take the object and turn back into assembly, but rather `object -> file -> assembly` path. It also has a `llvm-objdump` tool, but it is intended as a command-line utility and does not have a well-defined API.

- Writing custom functions to produce a readable assembly is not a priority. Also, mimicking `objdump` functionality would be difficult.

- Both `objdump` and `llvm-objdump` can be used to isnpect the `.o` file manually.

2. Refactoring of `Runner` class.

In addition to the support of dumping the binary, `Runner`and `JITDriver` classes were refactored to have a nicer OOP-style.

fixes #611

Co-authored-by: Pramod S Kumbhar <[email protected]>
iomaganaris pushed a commit that referenced this issue May 10, 2022
The following is added:

1. Dumping object files in JIT.

A functionality to dump (enabled by default) the generated from LLVM IR file binary to `.o` has been added to benchmarking. Now, in addition to logs, a `v<vector_width>_<mod_filename>.o` is generated. The reasons it is an object file and not an assembly (hence not included in logs) are the following:

- LLVM does not have library functions that take the object and turn back into assembly, but rather `object -> file -> assembly` path. It also has a `llvm-objdump` tool, but it is intended as a command-line utility and does not have a well-defined API.

- Writing custom functions to produce a readable assembly is not a priority. Also, mimicking `objdump` functionality would be difficult.

- Both `objdump` and `llvm-objdump` can be used to isnpect the `.o` file manually.

2. Refactoring of `Runner` class.

In addition to the support of dumping the binary, `Runner`and `JITDriver` classes were refactored to have a nicer OOP-style.

fixes #611

Co-authored-by: Pramod S Kumbhar <[email protected]>
iomaganaris pushed a commit that referenced this issue May 12, 2022
The following is added:

1. Dumping object files in JIT.

A functionality to dump (enabled by default) the generated from LLVM IR file binary to `.o` has been added to benchmarking. Now, in addition to logs, a `v<vector_width>_<mod_filename>.o` is generated. The reasons it is an object file and not an assembly (hence not included in logs) are the following:

- LLVM does not have library functions that take the object and turn back into assembly, but rather `object -> file -> assembly` path. It also has a `llvm-objdump` tool, but it is intended as a command-line utility and does not have a well-defined API.

- Writing custom functions to produce a readable assembly is not a priority. Also, mimicking `objdump` functionality would be difficult.

- Both `objdump` and `llvm-objdump` can be used to isnpect the `.o` file manually.

2. Refactoring of `Runner` class.

In addition to the support of dumping the binary, `Runner`and `JITDriver` classes were refactored to have a nicer OOP-style.

fixes #611

Co-authored-by: Pramod S Kumbhar <[email protected]>
iomaganaris pushed a commit that referenced this issue Sep 15, 2022
The following is added:

1. Dumping object files in JIT.

A functionality to dump (enabled by default) the generated from LLVM IR file binary to `.o` has been added to benchmarking. Now, in addition to logs, a `v<vector_width>_<mod_filename>.o` is generated. The reasons it is an object file and not an assembly (hence not included in logs) are the following:

- LLVM does not have library functions that take the object and turn back into assembly, but rather `object -> file -> assembly` path. It also has a `llvm-objdump` tool, but it is intended as a command-line utility and does not have a well-defined API.

- Writing custom functions to produce a readable assembly is not a priority. Also, mimicking `objdump` functionality would be difficult.

- Both `objdump` and `llvm-objdump` can be used to isnpect the `.o` file manually.

2. Refactoring of `Runner` class.

In addition to the support of dumping the binary, `Runner`and `JITDriver` classes were refactored to have a nicer OOP-style.

fixes #611

Co-authored-by: Pramod S Kumbhar <[email protected]>
iomaganaris pushed a commit that referenced this issue Sep 15, 2022
The following is added:

1. Dumping object files in JIT.

A functionality to dump (enabled by default) the generated from LLVM IR file binary to `.o` has been added to benchmarking. Now, in addition to logs, a `v<vector_width>_<mod_filename>.o` is generated. The reasons it is an object file and not an assembly (hence not included in logs) are the following:

- LLVM does not have library functions that take the object and turn back into assembly, but rather `object -> file -> assembly` path. It also has a `llvm-objdump` tool, but it is intended as a command-line utility and does not have a well-defined API.

- Writing custom functions to produce a readable assembly is not a priority. Also, mimicking `objdump` functionality would be difficult.

- Both `objdump` and `llvm-objdump` can be used to isnpect the `.o` file manually.

2. Refactoring of `Runner` class.

In addition to the support of dumping the binary, `Runner`and `JITDriver` classes were refactored to have a nicer OOP-style.

fixes #611

Co-authored-by: Pramod S Kumbhar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants