Add npcomp-verify-backend-contract pass.
This pass verifies that a given module satisfies the contract that we
have for backends. This is phrased as an "allowlist", because we want to
keep this interface tight. Also, this gives much better diagnostics than
a backend randomly crashing or failing to compile would (though they
could still be improved).
This was especially painful because if we had
`tensor<?x!numpy.any_dtype>` slip through, at some point RefBackend
would convert it to a memref type and trip the "verify type invariants"
assertion which gives no location or anything and crashed the process,
which was very unpleasant.
We implement this with the dialect conversion framework, which works
reasonably well and was quick to put together and familiar, but is still
very "op oriented". We probably want to make this hand-rolled
eventually, especially the error reporting (the most useful kind of
error for a dialect conversion user is not necessarily the best for this
use case). Also, in production, these error will go to users, and need
to be surfaced carefully such as "the compiler needs a type annotation
on this function parameter" which in general requires some special
analysis, wordsmithing, and overall awareness of the e2e use case (such
as how much we can lean into certain source locations) to provide a
meaningful user-level diagnostic.
Also, add `inline` to the current frontend lowering pass pipeline to
allow slightly more complicated programs that otherwise would fail on
shape inference.
2021-04-13 09:39:53 +08:00
|
|
|
add_subdirectory(Backend)
|
2020-09-29 09:36:00 +08:00
|
|
|
add_subdirectory(CAPI)
|
2020-05-07 09:41:54 +08:00
|
|
|
add_subdirectory(Conversion)
|
2020-04-27 08:20:58 +08:00
|
|
|
add_subdirectory(Dialect)
|
2021-04-29 05:36:46 +08:00
|
|
|
add_subdirectory(Interfaces)
|
2020-10-07 07:14:37 +08:00
|
|
|
add_subdirectory(RefBackend)
|
2020-07-01 09:28:39 +08:00
|
|
|
add_subdirectory(Typing)
|
2020-06-12 08:47:14 +08:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Setup the initialization target.
|
|
|
|
# This includes conditional dependencies based on whether features are enabled.
|
|
|
|
################################################################################
|
|
|
|
|
2020-10-09 09:29:59 +08:00
|
|
|
get_property(mlir_dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
|
|
|
|
get_property(mlir_conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
|
2020-08-06 05:49:18 +08:00
|
|
|
|
2020-10-09 09:29:59 +08:00
|
|
|
get_property(npcomp_dialect_libs GLOBAL PROPERTY NPCOMP_DIALECT_LIBS)
|
|
|
|
get_property(npcomp_conversion_libs GLOBAL PROPERTY NPCOMP_CONVERSION_LIBS)
|
|
|
|
|
|
|
|
message(STATUS "NPCOMP Dialect libs: ${npcomp_dialect_libs}")
|
|
|
|
message(STATUS "NPCOMP Conversion libs: ${npcomp_conversion_libs}")
|
|
|
|
|
|
|
|
add_npcomp_library(NPCOMPInitAll
|
2020-06-12 08:47:14 +08:00
|
|
|
InitAll.cpp
|
|
|
|
|
|
|
|
LINK_LIBS
|
|
|
|
|
2020-07-01 02:22:30 +08:00
|
|
|
PUBLIC
|
2020-06-12 08:47:14 +08:00
|
|
|
# Local depends
|
Add npcomp-verify-backend-contract pass.
This pass verifies that a given module satisfies the contract that we
have for backends. This is phrased as an "allowlist", because we want to
keep this interface tight. Also, this gives much better diagnostics than
a backend randomly crashing or failing to compile would (though they
could still be improved).
This was especially painful because if we had
`tensor<?x!numpy.any_dtype>` slip through, at some point RefBackend
would convert it to a memref type and trip the "verify type invariants"
assertion which gives no location or anything and crashed the process,
which was very unpleasant.
We implement this with the dialect conversion framework, which works
reasonably well and was quick to put together and familiar, but is still
very "op oriented". We probably want to make this hand-rolled
eventually, especially the error reporting (the most useful kind of
error for a dialect conversion user is not necessarily the best for this
use case). Also, in production, these error will go to users, and need
to be surfaced carefully such as "the compiler needs a type annotation
on this function parameter" which in general requires some special
analysis, wordsmithing, and overall awareness of the e2e use case (such
as how much we can lean into certain source locations) to provide a
meaningful user-level diagnostic.
Also, add `inline` to the current frontend lowering pass pipeline to
allow slightly more complicated programs that otherwise would fail on
shape inference.
2021-04-13 09:39:53 +08:00
|
|
|
NPCOMPCommonBackend
|
2021-04-09 04:05:16 +08:00
|
|
|
NPCOMPIREEBackend
|
2020-10-07 07:14:37 +08:00
|
|
|
NPCOMPRefBackend
|
2020-10-08 08:30:10 +08:00
|
|
|
NPCOMPRefbackDialect
|
2020-10-07 06:57:11 +08:00
|
|
|
NPCOMPTCPDialect
|
|
|
|
NPCOMPTCFDialect
|
2020-09-29 03:02:35 +08:00
|
|
|
NPCOMPTorchDialect
|
2020-10-08 08:12:52 +08:00
|
|
|
NPCOMPRefbackrtDialect
|
2020-06-12 08:47:14 +08:00
|
|
|
NPCOMPBasicpyDialect
|
|
|
|
NPCOMPBasicpyPasses
|
2020-08-28 06:09:10 +08:00
|
|
|
NPCOMPConversionPasses
|
2020-06-12 08:47:14 +08:00
|
|
|
NPCOMPNumpyDialect
|
2020-07-09 13:51:54 +08:00
|
|
|
NPCOMPNumpyPasses
|
2020-07-11 12:51:03 +08:00
|
|
|
NPCOMPTCFPasses
|
2020-07-05 07:56:09 +08:00
|
|
|
NPCOMPTypingPasses
|
2020-06-12 08:47:14 +08:00
|
|
|
|
2020-10-09 09:29:59 +08:00
|
|
|
${npcomp_dialect_libs}
|
|
|
|
${npcomp_conversion_libs}
|
|
|
|
${mlir_dialect_libs}
|
|
|
|
${mlir_conversion_libs}
|
2020-06-12 08:47:14 +08:00
|
|
|
)
|