This is an archive of the discontinued LLVM Phabricator instance.

[orc] Pass big JITTargetMachineBuilder parameters by reference to avoid unnecessary copies
Needs ReviewPublic

Authored by fzou1 on Dec 23 2022, 6:21 AM.

Details

Reviewers
lhames

Diff Detail

Event Timeline

fzou1 created this revision.Dec 23 2022, 6:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 23 2022, 6:21 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
fzou1 requested review of this revision.Dec 23 2022, 6:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 23 2022, 6:21 AM
fzou1 updated this revision to Diff 485266.Dec 25 2022, 8:29 PM

Apply clang format

fzou1 updated this revision to Diff 485301.Dec 26 2022, 6:31 AM
fzou1 retitled this revision from [orc] Pass big parameters by reference, instead of by value to [orc] Pass big JITTargetMachineBuilder parameters by reference to avoid unnecessary copies.

Update other big JITTargetMachineBuilder parameters passed by reference and format changes by clang-format tool

fzou1 updated this revision to Diff 485958.Jan 3 2023, 4:48 AM
fzou1 added a reviewer: lhames.

Update another parameter passed by reference and tutorials of building JIT and add const

Hi @fzou1,

JITTargetMachineBuilders are only moved around at startup at the moment, and they're only ~0.5kb. Have they been observed to have a performance impact? If so we should probably transfer them via unique_ptr to avoid the copies, but I'm not sure it's necessary yet.

llvm/docs/tutorial/BuildingAJIT1.rst
195–197

The introduction of EPC here seems unrelated to the other changes?

llvm/docs/tutorial/BuildingAJIT2.rst
61

Is this change related to the rest of the patch?

Hi @fzou1,

JITTargetMachineBuilders are only moved around at startup at the moment, and they're only ~0.5kb. Have they been observed to have a performance impact? If so we should probably transfer them via unique_ptr to avoid the copies, but I'm not sure it's necessary yet.

Sorry. No performance impact observed. They're nice-to-have changes. If needed, I'll update the patch with unique_ptr.

llvm/docs/tutorial/BuildingAJIT1.rst
195–197

Yes. But the example code is out of date and should be same as in KaleidoscopeJIT.h header file.

llvm/docs/tutorial/BuildingAJIT2.rst
61

Partly yes. This example code is out of date. I updated it together with the code of passing argument by reference.