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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ __pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# tensor files
*.safe
*.safetensors

# Metal libraries
*.metallib
venv/

# Distribution / packaging
python/mlx/core
Expand All @@ -30,19 +26,15 @@ lib64/
parts/
sdist/
var/
venv/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
uv.lock

# vim
*.swp

# Ignore build dir
build/
.DS_Store

# Prerequisites
*.d
Expand All @@ -52,6 +44,7 @@ build/
*.lo
*.o
*.obj
*.ilk

# Precompiled Headers
*.gch
Expand Down Expand Up @@ -80,9 +73,9 @@ build/
# Debug symbols
*.pdb

# VSCode
# VSCode
.vscode/
.DS_Store

# Jetbrains
.cache
.cache/
# vim
*.swp
17 changes: 12 additions & 5 deletions mlx/backend/cuda/jit_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ const std::filesystem::path& ptx_cache_dir() {
cache =
std::filesystem::temp_directory_path() / "mlx" / version() / "ptx";
}

#if defined(_WIN32)
// Add "\\?\" prefix to support long file path.
const wchar_t* long_path_prefix = L"\\\\?\\";
if (cache.is_relative()) {
cache = std::filesystem::absolute(cache);
}
if (!cache.native().starts_with(long_path_prefix)) {
cache = long_path_prefix + cache.native();
}
#endif

if (!std::filesystem::exists(cache)) {
std::error_code error;
if (!std::filesystem::create_directories(cache, error)) {
Expand All @@ -93,12 +105,7 @@ const std::filesystem::path& ptx_cache_dir() {
std::filesystem::path get_ptx_path(
const std::filesystem::path& cache_dir,
const std::string& module_name) {
#ifdef _WIN32
constexpr int max_file_name_length = 140;
#else
constexpr int max_file_name_length = 245;
#endif

if (module_name.size() <= max_file_name_length) {
return cache_dir / (module_name + ".ptx");
}
Expand Down
Loading