Introduce non-fatal check functions
Summary: This diff is adapted largely from dbort's diff D46040290. The goal is to allow kernels to check input conditions and fail non-fatally. To this end, shape and dtype checking macros have been replaced with `bool check_*();` functions and `ET_KERNEL_CHECK` is introduced as a non-fatal alternative to `ET_CHECK`. Some names from dbort's diff have been changed, and the `ET_KERNEL_CHECK` macros currently are identical to `ET_CHECK` but accept additional arguments to allow for non-fatal return down the line. Note that D46043104 must land first so that `context.fail()` is available before `ET_KERNEL_CHECK` can be non-fatal; for now, it will call `runtime_abort()` to maintain the same behaviour as `ET_CHECK`. The purpose of this diff is to introduce the `ET_KERNEL_CHECK` pattern so that we can begin replacing `ET_CHECK` with `ET_KERNEL_CHECK` in kernel code, thus reducing the number of callsites that have to be updated once D46043104 is landed. Reviewed By: dbort Differential Revision: D48165168 fbshipit-source-id: b56dde97d249f9a359e9f2d637275d0b4a4e72bf
S
Stephen Jia committed
7122df57b232fe673bd13b527b9e814fa8720fcd
Parent: e5f7869
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 8/10/2023, 9:25:25 PM