Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion 3rdparty/cutlass_fpA_intB_gemm
10 changes: 5 additions & 5 deletions 3rdparty/nvbench/l2_cache_flush.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
namespace tvm {
namespace runtime {

#define CUDA_CALL(func) \
{ \
cudaError_t e = (func); \
ICHECK(e == cudaSuccess || e == cudaErrorCudartUnloading) \
<< "CUDA: " << cudaGetErrorString(e); \
#define CUDA_CALL(func) \
{ \
cudaError_t e = (func); \
TVM_FFI_ICHECK(e == cudaSuccess || e == cudaErrorCudartUnloading) \
<< "CUDA: " << cudaGetErrorString(e); \
}

class L2Flush {
Expand Down
2 changes: 1 addition & 1 deletion apps/cpp_rpc/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ string GetCmdOption(int argc, char* argv[], string option, bool key = false) {
return cmd;
}
// We assume "=" is the end of option.
ICHECK_EQ(*option.rbegin(), '=');
TVM_FFI_ICHECK_EQ(*option.rbegin(), '=');
cmd = arg.substr(arg.find('=') + 1);
return cmd;
}
Expand Down
16 changes: 8 additions & 8 deletions apps/cpp_rpc/rpc_env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ RPCEnv::RPCEnv(const std::string& wd) {
std::string bin;

std::ifstream fs(file_name, std::ios::in | std::ios::binary);
ICHECK(!fs.fail()) << "Cannot open " << file_name;
TVM_FFI_ICHECK(!fs.fail()) << "Cannot open " << file_name;
fs.seekg(0, std::ios::end);
size_t size = static_cast<size_t>(fs.tellg());
fs.seekg(0, std::ios::beg);
Expand Down Expand Up @@ -199,7 +199,7 @@ std::vector<std::string> ListDir(const std::string& dirname) {
DIR* dp = opendir(dirname.c_str());
if (dp == nullptr) {
int errsv = errno;
LOG(FATAL) << "ListDir " << dirname << " error: " << strerror(errsv);
TVM_FFI_THROW(InternalError) << "ListDir " << dirname << " error: " << strerror(errsv);
}
dirent* d;
while ((d = readdir(dp)) != nullptr) {
Expand All @@ -220,7 +220,7 @@ std::vector<std::string> ListDir(const std::string& dirname) {
HANDLE handle = FindFirstFileA(pattern.c_str(), &fd);
if (handle == INVALID_HANDLE_VALUE) {
const int errsv = GetLastError();
LOG(FATAL) << "ListDir " << dirname << " error: " << strerror(errsv);
TVM_FFI_THROW(InternalError) << "ListDir " << dirname << " error: " << strerror(errsv);
}
do {
std::string filename = fd.cFileName;
Expand All @@ -235,7 +235,7 @@ std::vector<std::string> ListDir(const std::string& dirname) {
} while (FindNextFileA(handle, &fd));
FindClose(handle);
#else
LOG(FATAL) << "Operating system not supported";
TVM_FFI_THROW(InternalError) << "Operating system not supported";
#endif
return vec;
}
Expand All @@ -260,7 +260,7 @@ void LinuxShared(const std::string output, const std::vector<std::string>& files
std::string err_msg;
auto executed_status = support::Execute(cmd, &err_msg);
if (executed_status) {
LOG(FATAL) << err_msg;
TVM_FFI_THROW(InternalError) << err_msg;
}
}
#endif
Expand All @@ -285,7 +285,7 @@ void WindowsShared(const std::string& output, const std::vector<std::string>& fi
std::string err_msg;
const auto executed_status = support::Execute(cmd, &err_msg);
if (executed_status) {
LOG(FATAL) << err_msg;
TVM_FFI_THROW(InternalError) << err_msg;
}
}
#endif
Expand All @@ -301,7 +301,7 @@ void CreateShared(const std::string& output, const std::vector<std::string>& fil
#elif defined(_WIN32)
WindowsShared(output, files);
#else
LOG(FATAL) << "Operating system not supported";
TVM_FFI_THROW(InternalError) << "Operating system not supported";
#endif
}

Expand All @@ -323,7 +323,7 @@ std::string BuildSharedLibrary(std::string file) {
std::string err_msg;
const int executed_status = support::Execute(cmd, &err_msg);
if (executed_status) {
LOG(FATAL) << err_msg;
TVM_FFI_THROW(InternalError) << err_msg;
}
CreateShared(file_name, ListDir(tmp_dir));
CleanDir(tmp_dir);
Expand Down
20 changes: 10 additions & 10 deletions apps/cpp_rpc/rpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ class RPCServer {
support::TCPSocket conn = listen_sock_.Accept(addr);

int code = kRPCMagic;
ICHECK_EQ(conn.RecvAll(&code, sizeof(code)), sizeof(code));
TVM_FFI_ICHECK_EQ(conn.RecvAll(&code, sizeof(code)), sizeof(code));
if (code != kRPCMagic) {
conn.Close();
LOG(FATAL) << "Client connected is not TVM RPC server";
TVM_FFI_THROW(InternalError) << "Client connected is not TVM RPC server";
continue;
}

int keylen = 0;
ICHECK_EQ(conn.RecvAll(&keylen, sizeof(keylen)), sizeof(keylen));
TVM_FFI_ICHECK_EQ(conn.RecvAll(&keylen, sizeof(keylen)), sizeof(keylen));

const char* CLIENT_HEADER = "client:";
const char* SERVER_HEADER = "server:";
Expand All @@ -282,10 +282,10 @@ class RPCServer {
continue;
}

ICHECK_NE(keylen, 0);
TVM_FFI_ICHECK_NE(keylen, 0);
std::string remote_key;
remote_key.resize(keylen);
ICHECK_EQ(conn.RecvAll(&remote_key[0], keylen), keylen);
TVM_FFI_ICHECK_EQ(conn.RecvAll(&remote_key[0], keylen), keylen);

std::stringstream ssin(remote_key);
std::string arg0;
Expand All @@ -297,16 +297,16 @@ class RPCServer {

if (arg0 != expect_header) {
code = kRPCMismatch;
ICHECK_EQ(conn.SendAll(&code, sizeof(code)), sizeof(code));
TVM_FFI_ICHECK_EQ(conn.SendAll(&code, sizeof(code)), sizeof(code));
conn.Close();
LOG(WARNING) << "Mismatch key from" << addr->AsString();
continue;
} else {
code = kRPCSuccess;
ICHECK_EQ(conn.SendAll(&code, sizeof(code)), sizeof(code));
TVM_FFI_ICHECK_EQ(conn.SendAll(&code, sizeof(code)), sizeof(code));
keylen = int(server_key.length());
ICHECK_EQ(conn.SendAll(&keylen, sizeof(keylen)), sizeof(keylen));
ICHECK_EQ(conn.SendAll(server_key.c_str(), keylen), keylen);
TVM_FFI_ICHECK_EQ(conn.SendAll(&keylen, sizeof(keylen)), sizeof(keylen));
TVM_FFI_ICHECK_EQ(conn.SendAll(server_key.c_str(), keylen), keylen);
LOG(INFO) << "Connection success " << addr->AsString();
#ifndef __ANDROID__
ssin >> *opts;
Expand Down Expand Up @@ -343,7 +343,7 @@ class RPCServer {
size_t pos = opts.rfind(option);
if (pos != std::string::npos) {
const std::string cmd = opts.substr(pos + option.size());
ICHECK(support::IsNumber(cmd)) << "Timeout is not valid";
TVM_FFI_ICHECK(support::IsNumber(cmd)) << "Timeout is not valid";
return std::stoi(cmd);
}
return 0;
Expand Down
14 changes: 7 additions & 7 deletions apps/cpp_rpc/rpc_tracker_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ class TrackerClient {
tracker_sock_ = ConnectWithRetry();

int code = kRPCTrackerMagic;
ICHECK_EQ(tracker_sock_.SendAll(&code, sizeof(code)), sizeof(code));
ICHECK_EQ(tracker_sock_.RecvAll(&code, sizeof(code)), sizeof(code));
ICHECK_EQ(code, kRPCTrackerMagic) << tracker_addr_.c_str() << " is not RPC Tracker";
TVM_FFI_ICHECK_EQ(tracker_sock_.SendAll(&code, sizeof(code)), sizeof(code));
TVM_FFI_ICHECK_EQ(tracker_sock_.RecvAll(&code, sizeof(code)), sizeof(code));
TVM_FFI_ICHECK_EQ(code, kRPCTrackerMagic) << tracker_addr_.c_str() << " is not RPC Tracker";

std::ostringstream ss;
ss << "[" << static_cast<int>(TrackerCode::kUpdateInfo) << ", {\"key\": \"server:" << key_
Expand All @@ -95,7 +95,7 @@ class TrackerClient {

// Receive status and validate
std::string remote_status = tracker_sock_.RecvBytes();
ICHECK_EQ(std::stoi(remote_status), static_cast<int>(TrackerCode::kSuccess));
TVM_FFI_ICHECK_EQ(std::stoi(remote_status), static_cast<int>(TrackerCode::kSuccess));
}
}
/*!
Expand Down Expand Up @@ -124,7 +124,7 @@ class TrackerClient {

// Receive status and validate
std::string remote_status = tracker_sock_.RecvBytes();
ICHECK_EQ(std::stoi(remote_status), static_cast<int>(TrackerCode::kSuccess));
TVM_FFI_ICHECK_EQ(std::stoi(remote_status), static_cast<int>(TrackerCode::kSuccess));
} else {
*matchkey = key_;
}
Expand Down Expand Up @@ -174,7 +174,7 @@ class TrackerClient {
tracker_sock_.SendBytes(ss.str());

std::string remote_status = tracker_sock_.RecvBytes();
ICHECK_EQ(std::stoi(remote_status), static_cast<int>(TrackerCode::kSuccess));
TVM_FFI_ICHECK_EQ(std::stoi(remote_status), static_cast<int>(TrackerCode::kSuccess));
unmatch_period_count = 0;
}
continue;
Expand Down Expand Up @@ -206,7 +206,7 @@ class TrackerClient {
auto period = (std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now() - tbegin))
.count();
ICHECK(period < timeout) << "Failed to connect to server" << addr.AsString();
TVM_FFI_ICHECK(period < timeout) << "Failed to connect to server" << addr.AsString();
LOG(WARNING) << "Cannot connect to tracker " << addr.AsString() << " retry in "
<< retry_period << " seconds.";
std::this_thread::sleep_for(std::chrono::seconds(retry_period));
Expand Down
25 changes: 13 additions & 12 deletions apps/cpp_rpc/win32_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,19 @@ SOCKET GetSocket(const std::string& mmap_path) {
UniqueHandle parent_file_mapping_event;
if ((parent_file_mapping_event = MakeUniqueHandle(
OpenEventA(SYNCHRONIZE, false, parent_event_name.c_str()))) == nullptr) {
LOG(FATAL) << "OpenEvent() failed: " << GetLastError();
TVM_FFI_THROW(InternalError) << "OpenEvent() failed: " << GetLastError();
}

UniqueHandle child_file_mapping_event;
if ((child_file_mapping_event = MakeUniqueHandle(
OpenEventA(EVENT_MODIFY_STATE, false, child_event_name.c_str()))) == nullptr) {
LOG(FATAL) << "OpenEvent() failed: " << GetLastError();
TVM_FFI_THROW(InternalError) << "OpenEvent() failed: " << GetLastError();
}

// Wait for the parent to set the event, notifying WSAPROTOCOL_INFO is ready to be read
if (WaitForSingleObject(parent_file_mapping_event.get(), uint32_t(kEventTimeout.count())) !=
WAIT_OBJECT_0) {
LOG(FATAL) << "WaitForSingleObject() failed: " << GetLastError();
TVM_FFI_THROW(InternalError) << "WaitForSingleObject() failed: " << GetLastError();
}

const UniqueHandle file_map =
Expand All @@ -129,7 +129,7 @@ SOCKET GetSocket(const std::string& mmap_path) {
// Let the parent know we are finished duplicating the socket
SetEvent(child_file_mapping_event.get());
} else {
LOG(FATAL) << "MapViewOfFile() failed: " << GetLastError();
TVM_FFI_THROW(InternalError) << "MapViewOfFile() failed: " << GetLastError();
}

return sock_duplicated;
Expand Down Expand Up @@ -158,14 +158,14 @@ void SpawnRPCChild(SOCKET fd, seconds timeout) {
UniqueHandle parent_file_mapping_event;
if ((parent_file_mapping_event = MakeUniqueHandle(
CreateEventA(nullptr, true, false, parent_event_name.c_str()))) == nullptr) {
LOG(FATAL) << "CreateEvent for parent file mapping failed";
TVM_FFI_THROW(InternalError) << "CreateEvent for parent file mapping failed";
}

UniqueHandle child_file_mapping_event;
// An event to let the parent know the socket info was read from the mmap file
if ((child_file_mapping_event = MakeUniqueHandle(
CreateEventA(nullptr, true, false, child_event_name.c_str()))) == nullptr) {
LOG(FATAL) << "CreateEvent for child file mapping failed";
TVM_FFI_THROW(InternalError) << "CreateEvent for child file mapping failed";
}

char current_executable[MAX_PATH];
Expand All @@ -191,7 +191,7 @@ void SpawnRPCChild(SOCKET fd, seconds timeout) {
WSAPROTOCOL_INFO protocol_info;
// Get info needed to duplicate the socket
if (WSADuplicateSocket(fd, child_process_info.dwProcessId, &protocol_info) == SOCKET_ERROR) {
LOG(FATAL) << "WSADuplicateSocket(): failed. Error =" << WSAGetLastError();
TVM_FFI_THROW(InternalError) << "WSADuplicateSocket(): failed. Error =" << WSAGetLastError();
}

// Create a mmap file to store the info needed for duplicating the SOCKET in the child proc
Expand All @@ -203,7 +203,7 @@ void SpawnRPCChild(SOCKET fd, seconds timeout) {
}

if (GetLastError() == ERROR_ALREADY_EXISTS) {
LOG(FATAL) << "CreateFileMapping(): mapping file already exists";
TVM_FFI_THROW(InternalError) << "CreateFileMapping(): mapping file already exists";
} else {
void* map_view = MapViewOfFile(file_map.get(), FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);

Expand All @@ -218,12 +218,13 @@ void SpawnRPCChild(SOCKET fd, seconds timeout) {
if (WaitForSingleObject(child_file_mapping_event.get(), uint32_t(kEventTimeout.count())) !=
WAIT_OBJECT_0) {
TerminateProcess(child_process_handle.get(), 0);
LOG(FATAL) << "WaitForSingleObject for child file mapping timed out. Terminating child "
"process.";
TVM_FFI_THROW(InternalError)
<< "WaitForSingleObject for child file mapping timed out. Terminating child "
"process.";
}
} else {
TerminateProcess(child_process_handle.get(), 0);
LOG(FATAL) << "MapViewOfFile() failed: " << GetLastError();
TVM_FFI_THROW(InternalError) << "MapViewOfFile() failed: " << GetLastError();
}
}

Expand Down Expand Up @@ -254,7 +255,7 @@ void ChildProcSocketHandler(const std::string& mmap_path) {
if ((socket = GetSocket(mmap_path)) != INVALID_SOCKET) {
tvm::runtime::ServerLoopFromChild(socket);
} else {
LOG(FATAL) << "GetSocket() failed";
TVM_FFI_THROW(InternalError) << "GetSocket() failed";
}
}
} // namespace runtime
Expand Down
2 changes: 1 addition & 1 deletion apps/hexagon_launcher/launcher_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ tvm::runtime::Module load_module(const std::string& file_name) {
static const tvm::ffi::Function loader = get_runtime_func("ffi.Module.load_from_file.hexagon");
tvm::ffi::Any rv = loader(file_name);
if (rv.type_code() == kTVMModuleHandle) {
ICHECK_EQ(rv.type_code(), kTVMModuleHandle)
TVM_FFI_ICHECK_EQ(rv.type_code(), kTVMModuleHandle)
<< __func__ << ": loaded " << file_name << ", but did not get module handle";
return rv.operator tvm::runtime::Module();
}
Expand Down
6 changes: 3 additions & 3 deletions apps/hexagon_launcher/launcher_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ size_t get_file_size(std::ifstream&& in_file) {
std::string load_text_file(const std::string& file_name) {
constexpr size_t block_size = 1024 * 1024; // 1MB
std::ifstream in_file(file_name);
ICHECK(in_file.is_open()) << "cannot open file " << file_name;
TVM_FFI_ICHECK(in_file.is_open()) << "cannot open file " << file_name;
size_t file_size = get_file_size(in_file);
std::string buffer(file_size + 1, 0);

Expand All @@ -52,7 +52,7 @@ std::string load_text_file(const std::string& file_name) {

void* load_binary_file(const std::string& file_name, void* buffer, size_t buffer_size) {
std::ifstream in_file(file_name);
ICHECK(in_file.is_open()) << "cannot open file " << file_name;
TVM_FFI_ICHECK(in_file.is_open()) << "cannot open file " << file_name;
size_t file_size = get_file_size(in_file);

in_file.read(reinterpret_cast<std::ifstream::char_type*>(buffer),
Expand All @@ -62,7 +62,7 @@ void* load_binary_file(const std::string& file_name, void* buffer, size_t buffer

void write_binary_file(const std::string& file_name, void* buffer, size_t buffer_size) {
std::ofstream out_file(file_name);
ICHECK(out_file.is_open()) << "cannot open file " << file_name;
TVM_FFI_ICHECK(out_file.is_open()) << "cannot open file " << file_name;

out_file.write(reinterpret_cast<std::ofstream::char_type*>(buffer), buffer_size);
}
4 changes: 2 additions & 2 deletions include/tvm/arith/analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,10 @@ class TransitiveComparisonAnalyzer {
* arith::Analyzer analyzer;
* {
* With<arith::ConstraintContext> scope(&analyzer, x % 3 == 0);
* ICHECK_EQ(analyzer.modular_set(x)->coeff, 3);
* TVM_FFI_ICHECK_EQ(analyzer.modular_set(x)->coeff, 3);
* }
* // constraint no longer in effect.
* ICHECK_NE(analyzer.modular_set(x)->coeff, 3);
* TVM_FFI_ICHECK_NE(analyzer.modular_set(x)->coeff, 3);
*
* \endcode
*/
Expand Down
3 changes: 2 additions & 1 deletion include/tvm/ir/attrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ template <typename DerivedType>
class AttrsNodeReflAdapter : public BaseAttrsNode {
public:
void InitByPackedArgs(const ffi::PackedArgs& args, bool allow_unknown) final {
LOG(FATAL) << "`" << DerivedType::_type_key << "` uses new reflection mechanism for init";
TVM_FFI_THROW(InternalError) << "`" << DerivedType::_type_key
<< "` uses new reflection mechanism for init";
}

private:
Expand Down
Loading
Loading