Closed dcrc2 closed 2 years ago
Thanks! This seems cleaner to me.
An alternative would be to add an option to ksc to insert the correct #include for each prelude that was used.
That sounds like a good ultimate goal but this PR is a good stepping stone.
This PR removes the macro
KS_INLCUDE_ATEN
which controlled whether the fileprelude-aten.cpp
was included at the bottom ofknossos.h
. The immediate reason for doing this is that we're going to want a different version of the ATen prelude when compiling code for the GPU.Ideally, when the ATen prelude was used, the ksc-generated C++ would
#include "prelude-aten.cpp"
at the top of the file, immediately after#include "knossos.h"
.This PR achieves this by modifying the C++ immediately after it has been generated by ksc. (Actually it ends up writing
#include "prelude-aten.cpp"
before#include "knossos.h"
, but that's OK becauseprelude-aten.cpp
starts by includingknossos.h
anyway.)An alternative would be to add an option to ksc to insert the correct #include for each prelude that was used. This might be cleaner because it would mean that the C++ generated by ksc was self-contained. But since we're modifying ksc's generated code anyway (adding entry point definitions and the pybind module), it seems OK to add the #include here as well.