mirror of https://github.com/Jittor/Jittor
polish msvc crt shared link with -MD
This commit is contained in:
parent
1ccf45a03d
commit
9914e0918b
|
@ -1055,7 +1055,7 @@ if os.name == 'nt':
|
|||
cc_flags = cc_flags.replace("-lstdc++", "")
|
||||
cc_flags = cc_flags.replace("-ldl", "")
|
||||
cc_flags += f" -L\"{py3_link_path}\" -lpython3{sys.version_info.minor} "
|
||||
cc_flags += " -EHa "
|
||||
cc_flags += " -EHa -MD "
|
||||
import jittor_utils
|
||||
if jittor_utils.msvc_path:
|
||||
mp = jittor_utils.msvc_path
|
||||
|
@ -1142,6 +1142,7 @@ if has_cuda:
|
|||
if os.name == 'nt':
|
||||
nvcc_flags = nvcc_flags.replace("-fp:", "-Xcompiler -fp:")
|
||||
nvcc_flags = nvcc_flags.replace("-EHa", "-Xcompiler -EHa")
|
||||
nvcc_flags = nvcc_flags.replace("-M", "-Xcompiler -M")
|
||||
nvcc_flags = nvcc_flags.replace("-nologo", "")
|
||||
nvcc_flags = nvcc_flags.replace("-std:", "-std=")
|
||||
nvcc_flags = nvcc_flags.replace("-Fo:", "-o")
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// ***************************************************************
|
||||
// Copyright (c) 2021 Jittor. All Rights Reserved.
|
||||
// Maintainers: Dun Liang <randonlang@gmail.com>.
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
// ***************************************************************
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
|
||||
namespace jittor {
|
||||
|
||||
static inline int lzcnt(int64 v) {
|
||||
#ifdef __clang__
|
||||
#if __has_feature(__builtin_ia32_lzcnt_u64)
|
||||
return __builtin_ia32_lzcnt_u64(v);
|
||||
#else
|
||||
return v ? __builtin_clzll(v) : 64;
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
unsigned long index;
|
||||
_BitScanReverse64(&index, v);
|
||||
return v ? 63-index : 64;
|
||||
#else
|
||||
return __builtin_clzll(v);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
|
@ -6,25 +6,10 @@
|
|||
// ***************************************************************
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "misc/intrin.h"
|
||||
|
||||
namespace jittor {
|
||||
|
||||
static inline int lzcnt(int64 v) {
|
||||
#ifdef __clang__
|
||||
#if __has_feature(__builtin_ia32_lzcnt_u64)
|
||||
return __builtin_ia32_lzcnt_u64(v);
|
||||
#else
|
||||
return v ? __builtin_clzll(v) : 64;
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
return __lzcnt64(v);
|
||||
#else
|
||||
return __builtin_clzll(v);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
struct Slice {
|
||||
int64 start, stop, step, mask;
|
||||
inline void fill(int64 size) {
|
||||
|
|
|
@ -8,25 +8,10 @@
|
|||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include "common.h"
|
||||
#include "misc/intrin.h"
|
||||
|
||||
namespace jittor {
|
||||
|
||||
static inline int _lzcnt(int64 v) {
|
||||
#ifdef __clang__
|
||||
#if __has_feature(__builtin_ia32_lzcnt_u64)
|
||||
return __builtin_ia32_lzcnt_u64(v);
|
||||
#else
|
||||
return v ? __builtin_clzll(v) : 64;
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
return __lzcnt64(v);
|
||||
#else
|
||||
return __builtin_clzll(v);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
struct SimpleProfiler {
|
||||
string name;
|
||||
int64 cnt;
|
||||
|
@ -63,7 +48,7 @@ struct SimpleProfiler {
|
|||
inline SimpleProfiler(string&& name): name(move(name)), cnt(0), total_ns(0), sum(0) {}
|
||||
inline ~SimpleProfiler() { report(); }
|
||||
inline void add(int64 time, int64 s) {
|
||||
auto nbit = 64 - _lzcnt(time);
|
||||
auto nbit = 64 - lzcnt(time);
|
||||
auto i = (nbit-1) / 5;
|
||||
if (i>6) i=6;
|
||||
cnt ++;
|
||||
|
|
|
@ -494,7 +494,8 @@ int system_popen(const char *cmd, const char* cwd) {
|
|||
bSuccess = ReadFile(g_hChildStd_OUT_Rd, chBuf, BUFSIZ, &dwRead, NULL);
|
||||
if (!bSuccess || dwRead == 0)
|
||||
break;
|
||||
output += chBuf;
|
||||
output += string(chBuf, dwRead);
|
||||
|
||||
if (log_v)
|
||||
bSuccess = WriteFile(hParentStdOut, chBuf,
|
||||
dwRead, &dwWritten, NULL);
|
||||
|
|
|
@ -8,7 +8,7 @@ def install(path):
|
|||
LOG.i("Installing MSVC...")
|
||||
filename = "msvc.zip"
|
||||
url = "https://cg.cs.tsinghua.edu.cn/jittor/assets/" + filename
|
||||
md5sum = "929c4b86ea68160121f73c3edf6b5463"
|
||||
md5sum = "55f0c175fdf1419b124e0fc498b659d2"
|
||||
download_url_to_local(url, filename, path, md5sum)
|
||||
fullname = os.path.join(path, filename)
|
||||
import zipfile
|
||||
|
|
Loading…
Reference in New Issue