Skip to content

[SYCL][NFC] Remove makeResultFilename function from sycl-post-link - #17602

Merged
uditagarwal97 merged 13 commits into
intel:syclfrom
maksimsab:refactor_io1
Jul 16, 2025
Merged

uditagarwal97 merged 13 commits into
intel:syclfrom
maksimsab:refactor_io1

Conversation

@maksimsab

@maksimsab maksimsab commented Mar 24, 2025 •

Copy link
Copy Markdown
Contributor

The functionality of the makeResultFilename function has been moved to the getOutputPrefix function, and it is invoked at the beginning of the program.

Two SaveModuleIR functions have been merged into one function.

The output setup in the saveModuleProperties function has been moved out of the function for simplification.

This simplifying change is mandatory for the later migration of IO utilities of sycl-post-link to the library.

The functionality of the makeResultFilename function has been moved to the getOutputPrefix function, and it is invoked at the beginning of the program.

Two SaveModuleIR functions have been merged into one function.

The output setup in the saveModuleProperties function has been moved out of the function for simplification.

Two dead ifs have been removed.

This simplifying change is mandatory for the later migration of IO utilities of sycl-post-link to the library.
@maksimsab
maksimsab requested a review from a team as a code owner March 24, 2025 13:19

@maarquitos14 maarquitos14 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits. LGTM otherwise.

@maksimsab

Copy link
Copy Markdown
Contributor Author

Update: My original statement in the comment "OutputFiless size is never zero" turned out to be false and subsequent refactorings weren't correct. Therefore, I removed changes related to OutIRFileName and IRFilename in saveModule.

@maarquitos14 Could you please rereview this PR?

}

void saveModuleIR(Module &M, StringRef OutFilename) {
void saveModuleIR(Module &M, const StringRef Filename) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void saveModuleIR(Module &M, const StringRef Filename) {
void saveModuleIR(const Module &M, const StringRef Filename) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MPM.run would not accept a const reference.

// the result.
void saveModule(std::vector<std::unique_ptr<util::SimpleTable>> &OutTables,
module_split::ModuleDesc &MD, int I, StringRef IRFilename) {
/// \param OutTables List of tables (one for each target) to output results

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a 'target'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From some time ago we started support targets in sycl-post-link. Therefore, each target gets it's own table.
Links: #12727 and #12252

writeToFile(Filename, SymT);
}

// Compute the filename suffix for the module

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be merged with getOutputSuffix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have only getOutputPrefix at the moment. I've just noticed that we don't need the function getModuleSuffix being used only once.

if (!Target.empty())
NewSuff = (Twine("_") + Target).str();

CopyTriple.Prop =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious. Why do we not use DoPropGen flag here to guard 'saveModuleProperties'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we do use the flag.

if (IsBF16DeviceLibUsed && (DeviceLibDir.getNumOccurrences() > 0)) {
saveDeviceLibModule(Tables, ID, "libsycl-fallback-bfloat16.bc");
saveDeviceLibModule(Tables, ID + 1, "libsycl-native-bfloat16.bc");
saveDeviceLibModule(Tables, OutputPrefix, ID,

@asudarsa asudarsa Jul 2, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be cleaner to populate a global constant with the list of device library module filenames and use that here? Ideally, it should be passed in as an option to sycl-post-link.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could leave that for later.

@asudarsa asudarsa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few nitpicks. May be update PR title as something like 'Code changes to prepare for sycl-post-link librarification'?

Thanks

@maksimsab

Copy link
Copy Markdown
Contributor Author

Hi @intel/llvm-gatekeepers !
Could we please merge this PR?

@uditagarwal97
uditagarwal97 merged commit f9de199 into intel:sycl Jul 16, 2025
@maksimsab
maksimsab deleted the refactor_io1 branch July 16, 2025 14:34

This branch was previously deployed

1 inactive deployment
WindowsCILock — d229ab07 Deployed Jul 15, 2025 by maksimsab
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

Successfully merging this pull request may close these issues.

5 participants