Bundler currently requires host triple to be provided no matter if you are performing bundling or unbundling, but for unbundling operation such requirement is too restrictive. You may for example want to examine device part of the object for a particular offload target, but you have to extract host part as well even though you do not need it. Host triple isn't really needed for unbundling, so this patch removes that requirement.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
---|---|---|
888 ↗ | (On Diff #217234) | I believe, for unbundling we also must check for != 1 rather than > 1. Zero host targets also is not allowed. |
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
---|---|---|
888 ↗ | (On Diff #217234) | But the whole idea of this change is to remove requirement to provide host triple for unbundling operation. Target bundle(s) can always be extracted without extracting host, so host bundle is optional. Therefore zero host targets should not be considered as error for unbundling. |
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
---|---|---|
888 ↗ | (On Diff #217234) | And why do we need this? I think it would be better to check that the requested host triple matches the bundled one using this parameter rather than removing it. |
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
---|---|---|
888 ↗ | (On Diff #217234) |
As I wrote in the summary it is a usability issue. You may for example want to extract device object for a particular offload target to examine its contents (symbols, sections, etc..), but currently you also have to extract host bundle as well even if you do not need it.
So you suggest to check that host bundle name that exists in the fat image matches the host bundle name provided it command line if it was provided? Should it be an error if names do not match? |
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
---|---|---|
888 ↗ | (On Diff #217234) | I have updated patch to do error checking if host bundle name was provided in command line. |
clang/test/Driver/clang-offload-bundler.c | ||
---|---|---|
228–231 ↗ | (On Diff #217259) | What about tests for other kinds of elements like preprocessed code, IR, objects, etc.? |
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
795 ↗ | (On Diff #217259) | There must be a test for this change. better to implement it in a different patch, I think. |
888 ↗ | (On Diff #217234) | Ok, I got the idea of the patch. BTW, will happen if I request the device code for the triple, which is correct, but bundled container does not have the device code for this triple? |
clang/test/Driver/clang-offload-bundler.c | ||
---|---|---|
228–231 ↗ | (On Diff #217259) | Ok, I can add more tests for reprocessed code, IR, etc. I have added one test per file handler type so far, but I can do it per file type. BTW, test for object type is already there on line 264. |
clang/test/Driver/clang-offload-bundler.c | ||
---|---|---|
228–231 ↗ | (On Diff #217259) | One note that adding more tests for binary file handler would most probably require this fix https://reviews.llvm.org/D66598. Can you please take a look at this patch? |
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
---|---|---|
888 ↗ | (On Diff #217234) | What about this? |
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | ||
---|---|---|
888 ↗ | (On Diff #217234) | Based on the comments on lines 775-776 and 801 in ClangOffloadBundler.cpp bundler will create empty files for missing device bundles. |