tvm_runtime.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. #include <stdarg.h>
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <tvm/runtime/c_runtime_api.h>
  23. #include <tvm/runtime/crt/stack_allocator.h>
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. void __attribute__((noreturn)) TVMPlatformAbort(tvm_crt_error_t error_code) {
  28. printf("TVMPlatformAbort: %d\n", error_code);
  29. printf("EXITTHESIM\n");
  30. exit(-1);
  31. }
  32. tvm_crt_error_t TVMPlatformMemoryAllocate(size_t num_bytes, DLDevice dev, void** out_ptr) {
  33. return kTvmErrorFunctionCallNotImplemented;
  34. }
  35. tvm_crt_error_t TVMPlatformMemoryFree(void* ptr, DLDevice dev) {
  36. return kTvmErrorFunctionCallNotImplemented;
  37. }
  38. void TVMLogf(const char* msg, ...) {
  39. va_list args;
  40. va_start(args, msg);
  41. vfprintf(stdout, msg, args);
  42. va_end(args);
  43. }
  44. TVM_DLL int TVMFuncRegisterGlobal(const char* name, TVMFunctionHandle f, int override) { return 0; }
  45. #ifdef __cplusplus
  46. }
  47. #endif