Skip to content

Commit

Permalink
Fixed compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
PENGUINLIONG committed Sep 17, 2022
1 parent 97ebb7e commit 936a2f6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions taichi/program/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
#include "taichi/rhi/dx/dx_api.h"
#endif

#if defined(TI_ARCH_x64) && !(defined(__arm64__) || defined(__aarch64__))
#if defined(_M_X64) || defined(__x86_64)
// For _MM_SET_FLUSH_ZERO_MODE
#include <xmmintrin.h>
#endif
#endif // defined(_M_X64) || defined(__x86_64)

namespace taichi {
namespace lang {
Expand All @@ -55,10 +55,10 @@ Program::Program(Arch desired_arch) : snode_rw_accessors_bank_(this) {
// For performance considerations and correctness of QuantFloatType
// operations, we force floating-point operations to flush to zero on all
// backends (including CPUs).
#if !(defined(__arm64__) || defined(__aarch64__))
#if defined(TI_ARCH_x64)
#if defined(_M_X64) || defined(__x86_64)
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
#else
#endif // defined(_M_X64) || defined(__x86_64)
#if defined(__arm64__) || defined(__aarch64__)
// Enforce flush to zero on arm64 CPUs
// https://developer.arm.com/documentation/100403/0201/register-descriptions/advanced-simd-and-floating-point-registers/aarch64-register-descriptions/fpcr--floating-point-control-register?lang=en
std::uint64_t fpcr;
Expand All @@ -69,8 +69,7 @@ Program::Program(Arch desired_arch) : snode_rw_accessors_bank_(this) {
:
: "ri"(fpcr | (1 << 24))); // Bit 24 is FZ
__asm__ __volatile__("");
#endif
#endif // !(defined(__arm64__) || defined(__aarch64__))
#endif // defined(__arm64__) || defined(__aarch64__)
config = default_compile_config;
config.arch = desired_arch;
// TODO: allow users to run in debug mode without out-of-bound checks
Expand Down

0 comments on commit 936a2f6

Please sign in to comment.