This is an archive of the discontinued LLVM Phabricator instance.

[mlir][NFC] Use options struct in ExecutionEngine::create
ClosedPublic

Authored by cota on Feb 22 2022, 7:35 PM.

Details

Summary

Its number of optional parameters has grown too large,
which makes adding new optional parameters quite a chore.

Fix this by using an options struct.

Diff Detail

Event Timeline

cota created this revision.Feb 22 2022, 7:35 PM
cota requested review of this revision.Feb 22 2022, 7:35 PM
mehdi_amini accepted this revision.Feb 22 2022, 7:38 PM
mehdi_amini added inline comments.
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
73

Can you improve the comment to explain where will the cache be located?

This revision is now accepted and ready to land.Feb 22 2022, 7:38 PM
cota added inline comments.Feb 22 2022, 7:53 PM
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
73

Can you please suggest a rephrase? I am struggling to see how the location of the cache is unclear given the comment, but perhaps I'm missing something. Thanks!

mehdi_amini added inline comments.Feb 22 2022, 8:06 PM
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
73

Aren't the object will be stored on disk? How is the user turning this boolean to true supposed to get access to the objects?

I'm also not sure why this is true by default?

cota added inline comments.Feb 23 2022, 6:50 AM
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
73

Thanks for clarifying.
The enableObjectCache option was added in https://reviews.llvm.org/rG06e8101034e, defaulting to false. However, the init code added there got its logic reversed (cache(enableObjectCache ? nullptr : new SimpleObjectCache()), which was fixed in https://reviews.llvm.org/rGd1186fcb04 by setting the default to true (i.e. preserving the existing behavior even if it perhaps was unintentional).
I'll ask the authors of those patches about what the default should be and will get back to this in a follow-up patch.
In the meantime I'll commit this patch since I have other changes pending on it.

This revision was automatically updated to reflect the committed changes.