已合并
fix printf O3 bug #388
louyuxuan创建于 2月6日
fix printf O3 bug #388
已合并
共 4 个文件变更+8-16
| @@ -33,7 +33,7 @@ __SIMT_DEVICE_FUNCTIONS_DECL__ inline void __trap() | |||
| 33 | 33 | ||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | -__SIMT_DEVICE_FUNCTIONS_DECL__ inline void __assert_fail(const char* __assertion, | 36 | +static __attribute__((noinline)) __SIMT_DEVICE_FUNCTIONS_DECL__ void __assert_fail(const char* __assertion, |
| 37 | const char* __file, unsigned int __line, const char* __function) noexcept | 37 | const char* __file, unsigned int __line, const char* __function) noexcept |
| 38 | { | 38 | { |
| 39 | simt_printf_impl(DumpType::DUMP_SIMT_ASSERT, "[ASSERT] %s:%u: %s: Assertion `%s' failed.\n", __file, __line, | 39 | simt_printf_impl(DumpType::DUMP_SIMT_ASSERT, "[ASSERT] %s:%u: %s: Assertion `%s' failed.\n", __file, __line, |
| @@ -48,7 +48,7 @@ __SIMT_DEVICE_FUNCTIONS_DECL__ inline void __trap() | |||
| 48 | 48 | ||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | -__SIMT_DEVICE_FUNCTIONS_DECL__ inline void __assert_fail(const __gm__ char* __assertion, | 51 | +static __attribute__((noinline)) __SIMT_DEVICE_FUNCTIONS_DECL__ void __assert_fail(const __gm__ char* __assertion, |
| 52 | const __gm__ char* __file, unsigned int __line, const __gm__ char* __function) noexcept | 52 | const __gm__ char* __file, unsigned int __line, const __gm__ char* __function) noexcept |
| 53 | { | 53 | { |
| 54 | simt_printf_impl(DumpType::DUMP_SIMT_ASSERT, "[ASSERT] %s:%u: %s: Assertion `%s' failed.\n", __file, __line, | 54 | simt_printf_impl(DumpType::DUMP_SIMT_ASSERT, "[ASSERT] %s:%u: %s: Assertion `%s' failed.\n", __file, __line, |
| @@ -479,9 +479,9 @@ __SIMT_DEVICE_FUNCTIONS_DECL__ inline void simt_printf_impl(DumpType print_type, | |||
| 479 | 479 | ||
| 480 | 480 | ||
| 481 | template <class... Args> | 481 | template <class... Args> |
| 482 | -__SIMT_DEVICE_FUNCTIONS_DECL__ __attribute__((always_inline)) inline void printf(const __gm__ char* fmt, Args&&... args) | 482 | +static __attribute__((noinline)) __SIMT_DEVICE_FUNCTIONS_DECL__ void printf(const __gm__ char* fmt, Args&&... args) |
| 483 | { | 483 | { |
| 484 | -#if defined (ASCENDC_DUMP) && (ASCENDC_DUMP == 1) | 484 | +#if !defined (ASCENDC_DUMP) || (ASCENDC_DUMP != 0) |
| 485 | simt_printf_impl(DumpType::DUMP_SIMT_PRINTF, fmt, args...); | 485 | simt_printf_impl(DumpType::DUMP_SIMT_PRINTF, fmt, args...); |
| 486 | 486 | ||
| 487 | } | 487 | } |
| @@ -28,24 +28,16 @@ | |||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | + | ||
| 32 | + | ||
| 31 | namespace __asc_simt_vf { | 33 | namespace __asc_simt_vf { |
| 32 | __SIMT_DEVICE_FUNCTIONS_DECL__ inline void __trap(); | 34 | __SIMT_DEVICE_FUNCTIONS_DECL__ inline void __trap(); |
| 33 | - | ||
| 34 | - | ||
| 35 | -__SIMT_DEVICE_FUNCTIONS_DECL__ inline void __assert_fail(const char* __assertion, const char* __file, | ||
| 36 | - unsigned int __line, const char* __function) noexcept; | ||
| 37 | - | ||
| 38 | -__SIMT_DEVICE_FUNCTIONS_DECL__ inline void __assert_fail(const __gm__ char* __assertion, const __gm__ char* __file, | ||
| 39 | - unsigned int __line, const __gm__ char* __function) noexcept; | ||
| 40 | - | ||
| 41 | } // namespace __asc_simt_vf | 35 | } // namespace __asc_simt_vf |
| 42 | 36 | ||
| 43 | 37 | ||
| 44 | 38 | ||
| 45 | 39 | ||
| 46 | 40 | ||
| 47 | - | ||
| 48 | - | ||
| 49 | 41 | ||
| 50 | 42 | ||
| 51 | 43 | ||
| @@ -28,9 +28,9 @@ | |||
| 28 | namespace __asc_simt_vf { | 28 | namespace __asc_simt_vf { |
| 29 | template <class... Args> | 29 | template <class... Args> |
| 30 | 30 | ||
| 31 | -__attribute__((always_inline)) inline __SIMT_DEVICE_FUNCTIONS_DECL__ void printf(const __gm__ char* fmt, Args&&... args); | 31 | +static __attribute__((noinline)) __SIMT_DEVICE_FUNCTIONS_DECL__ void printf(const __gm__ char* fmt, Args&&... args); |
| 32 | 32 | ||
| 33 | -__attribute__((always_inline)) inline __SIMT_DEVICE_FUNCTIONS_DECL__ void printf(const char* fmt, Args&&... args); | 33 | +static __attribute__((noinline)) __SIMT_DEVICE_FUNCTIONS_DECL__ void printf(const char* fmt, Args&&... args); |
| 34 | 34 | ||
| 35 | } // namespase __asc_simt_vf | 35 | } // namespase __asc_simt_vf |
| 36 | 36 | ||