imc_extension.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef INC_IMC_IMC_EXTENSION_H_
  2. #define INC_IMC_IMC_EXTENSION_H_
  3. #ifndef imcBENCH_NAME
  4. #define imcBENCH_NAME vConv2d
  5. #endif
  6. #ifndef imcBENCH_INFINITE_LOOP
  7. #define imcBENCH_INFINITE_LOOP 0
  8. #endif
  9. #ifndef imcPRINT_RECOVERY_MESSAGE
  10. #define imcPRINT_RECOVERY_MESSAGE 0
  11. #endif
  12. #ifndef imcENABLE_STATIC_LOOP_PASS_COUNT
  13. #define imcENABLE_STATIC_LOOP_PASS_COUNT 0
  14. #endif
  15. #ifndef imcENABLE_ADAPTIVE_LOOP_PASS_COUNT
  16. #define imcENABLE_ADAPTIVE_LOOP_PASS_COUNT 1
  17. #endif
  18. #ifndef imcMAX_LOOP_IDS
  19. #define imcMAX_LOOP_IDS 1
  20. #endif
  21. #ifndef imcLOOP_PASS_COUNT
  22. #define imcLOOP_PASS_COUNT 10
  23. #endif
  24. #ifndef imcBENCH_REPEAT_COUNT
  25. #define imcBENCH_REPEAT_COUNT 1
  26. #endif
  27. #ifndef imcPRINT_STATS
  28. #define imcPRINT_STATS 0
  29. #endif
  30. #ifndef imcCUSTOM_UNROLL
  31. #define imcCUSTOM_UNROLL 0
  32. #endif
  33. #define IMC_KERNEL_NVM __attribute__((section(".kernel_nvm")))
  34. #define imcCAP_VOL_HIGH 4800
  35. #define imcCAP_VOL_LOW 3500
  36. #define imcENERGY_TOTAL (imcCAP_VOL_HIGH*imcCAP_VOL_HIGH - imcCAP_VOL_LOW*imcCAP_VOL_LOW)
  37. #if (imcCUSTOM_UNROLL)
  38. // #define STRINGIFY(x) ("clang loop unroll_count(" ##str ")")
  39. #define DO_PRAGMA(x) _Pragma ( #x )
  40. #define IMC_UNROLL(x) DO_PRAGMA( clang loop unroll_count(x+1) )
  41. #define IMC_UNROLL_FULL() DO_PRAGMA( clang loop unroll(full) )
  42. #else
  43. #define IMC_UNROLL(x)
  44. #define IMC_UNROLL_FULL()
  45. #endif
  46. int __imc_get_loop_pass_count(int loop_id);
  47. void __imc_finish_loop_skipping();
  48. void imc_init_energy_estimation();
  49. void imc_recover_estimations();
  50. void imc_backup_estimations();
  51. extern int imc_is_passing_loops;
  52. extern int imc_checkpoint_triggered;
  53. extern int imc_checkpoint_executed;
  54. #endif