Make various updates and fixes:
- Add support for legacy CUDA versions; now compatible with CUDA 12.3 and newer - Add support for NVRTC compilation - Other fixes and code refactoring
This commit is contained in:
@@ -35,6 +35,16 @@ do { \
|
||||
#define DG_HOST_UNREACHABLE(reason) (throw DGException("Assertion", __FILE__, __LINE__, reason))
|
||||
#endif
|
||||
|
||||
#ifndef DG_NVRTC_CHECK
|
||||
#define DG_NVRTC_CHECK(cmd) \
|
||||
do { \
|
||||
const auto& e = (cmd); \
|
||||
if (e != NVRTC_SUCCESS) { \
|
||||
throw DGException("NVRTC", __FILE__, __LINE__, nvrtcGetErrorString(e)); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef DG_CUDA_DRIVER_CHECK
|
||||
#define DG_CUDA_DRIVER_CHECK(cmd) \
|
||||
do { \
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#define DG_DECLARE_STATIC_VAR_IN_CLASS(cls, name) decltype(cls::name) cls::name
|
||||
|
||||
namespace deep_gemm {
|
||||
|
||||
template <typename T>
|
||||
class LazyInit {
|
||||
public:
|
||||
explicit LazyInit(std::function<std::shared_ptr<T>()> factory)
|
||||
: factory(std::move(factory)) {}
|
||||
|
||||
T* operator -> () {
|
||||
if (ptr == nullptr)
|
||||
ptr = factory();
|
||||
return ptr.get();
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<T> ptr;
|
||||
std::function<std::shared_ptr<T>()> factory;
|
||||
};
|
||||
|
||||
} // namespace deep_gemm
|
||||
@@ -38,8 +38,8 @@ static std::tuple<int, std::string> call_external_command(std::string command) {
|
||||
std::string output;
|
||||
while (fgets(buffer.data(), buffer.size(), pipe.get()))
|
||||
output += buffer.data();
|
||||
const auto exit_code = pclose(pipe.release());
|
||||
return {WEXITSTATUS(exit_code), output};
|
||||
const auto& exit_code = WEXITSTATUS(pclose(pipe.release()));
|
||||
return {exit_code, output};
|
||||
}
|
||||
|
||||
static std::vector<std::filesystem::path> collect_files(const std::filesystem::path& root) {
|
||||
|
||||
Reference in New Issue
Block a user