Fix #define location post-optimisation.

With recent optimisations, tesla_instance_active() lives in tesla_internal.h so that it can be inlined. In the kernel, this is before assert() is defined; move #ifdef _KERNEL #define assert() to near the top of this header.