tvm_runtime.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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,
  33. void **out_ptr) {
  34. return kTvmErrorFunctionCallNotImplemented;
  35. }
  36. tvm_crt_error_t TVMPlatformMemoryFree(void *ptr, DLDevice dev) {
  37. return kTvmErrorFunctionCallNotImplemented;
  38. }
  39. void TVMLogf(const char *msg, ...) {
  40. va_list args;
  41. va_start(args, msg);
  42. vfprintf(stdout, msg, args);
  43. va_end(args);
  44. }
  45. TVM_DLL int TVMFuncRegisterGlobal(const char *name, TVMFunctionHandle f,
  46. int override) {
  47. return 0;
  48. }
  49. #ifdef __cplusplus
  50. }
  51. #endif