Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set FLUSH_TO_ZERO ON by default #11906

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/target/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <sstream>
#include <unordered_set>
#include <vector>
#include <xmmintrin.h>

namespace tvm {
namespace codegen {
Expand All @@ -54,6 +55,13 @@ runtime::Module Build(IRModule mod, Target target) {

// the build function.
std::string build_f_name = "target.build." + target->kind->name;
if (target->kind->name == "llvm" && !(_mm_getcsr() & 0x8040)) {
LOG(WARNING) << "Set FLUSH_TO_ZERO ON by default in Build on LLVM."<< std::endl;
//DAZ
_mm_setcsr( _mm_getcsr() | 0x0040 );
//FTZ
_mm_setcsr( _mm_getcsr() | 0x8000 );
}
Comment on lines +58 to +64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should be in the runtime not the build. What happens if someone builds remotely and then uploads the compiled artifact? Seems like flush to zero would not be changed.

Copy link
Contributor

@AndrewZhaoLuo AndrewZhaoLuo Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this portable? Also can we just leverage LLVM through like a flag or something like #9223?

const PackedFunc* bf = runtime::Registry::Get(build_f_name);
ICHECK(bf != nullptr) << build_f_name << " is not enabled";
return (*bf)(mod, target);
Expand Down