Skip to content

Commit f5e0eb8

Browse files
authored
Merge branch 'main' into phi4-export
2 parents c05764c + 2ff9abd commit f5e0eb8

30 files changed

+1097
-362
lines changed

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ parameterized==0.9.0
1717

1818
# Doc build requirements, same as https://github.com/pytorch/pytorch/blob/main/.ci/docker/requirements-docs.txt
1919
sphinx==5.3.0
20+
sphinx-reredirects==0.1.4
2021
sphinx-gallery==0.14.0
2122
breathe==4.34.0
2223
exhale==0.2.3

.github/workflows/_android.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
script: |
2323
set -eux
2424
25+
# Use sccache for NDK compiler as well
26+
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
27+
export CMAKE_C_COMPILER_LAUNCHER=sccache
28+
2529
# The generic Linux job chooses to use base env, not the one setup by the image
2630
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
2731
conda activate "${CONDA_ENV}"

.github/workflows/android-perf.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ jobs:
353353
script: |
354354
set -eux
355355
356+
# Use sccache for NDK compiler as well
357+
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
358+
export CMAKE_C_COMPILER_LAUNCHER=sccache
359+
356360
# The generic Linux job chooses to use base env, not the one setup by the image
357361
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
358362
conda activate "${CONDA_ENV}"
@@ -392,7 +396,7 @@ jobs:
392396
fail-fast: false
393397
with:
394398
# Due to scheduling a job may be pushed beyond the default 60m threshold
395-
timeout: 120
399+
timeout: 240
396400
device-type: android
397401
runner: linux.2xlarge
398402
test-infra-ref: ''

.github/workflows/android-release-artifacts.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ jobs:
6060
script: |
6161
set -eux
6262
63+
# Use sccache for NDK compiler as well
64+
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
65+
export CMAKE_C_COMPILER_LAUNCHER=sccache
66+
6367
# The generic Linux job chooses to use base env, not the one setup by the image
6468
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
6569
conda activate "${CONDA_ENV}"

backends/vulkan/runtime/api/containers/Tensor.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,26 @@ vkapi::VulkanImage allocate_image(
260260
return vkapi::VulkanImage();
261261
}
262262

263+
// TODO(ssjia): change to always check that the image extents do not exceed
264+
// physical limits. Adding the check now based on `maxImageDimension3D` will
265+
// cause some existing models to break. Anecdotally, on Adreno and
266+
// SwiftShader devices, using 3D textures that exceed `maxImageDimension3D`
267+
// appears to be ok. So we need to figure out if is it undefined behaviour
268+
// or if there's a better way to figure out what the limit is. For now, only
269+
// check during debug build so that we can detect when exceeding physical
270+
// limits could be a potential cause for model outputs to be wrong. In the
271+
// meantime, the threshold for using texture storage can be configured at
272+
// export time.
273+
#ifdef VULKAN_DEBUG
274+
uint32_t max_extent = storage_type == utils::kTexture3D
275+
? adapter_ptr->max_texture3d_dim()
276+
: adapter_ptr->max_texture2d_dim();
277+
278+
VK_CHECK_COND(
279+
image_extents[0] <= max_extent && image_extents[1] <= max_extent &&
280+
image_extents[2] <= max_extent);
281+
#endif
282+
263283
VkSampler sampler = adapter_ptr->sampler_cache().retrieve(sampler_props);
264284

265285
return adapter_ptr->vma().create_image(
@@ -291,6 +311,8 @@ vkapi::VulkanBuffer allocate_buffer(
291311
return vkapi::VulkanBuffer();
292312
}
293313

314+
VK_CHECK_COND(numel <= context_ptr->adapter_ptr()->max_buffer_numel());
315+
294316
return adapter_ptr->vma().create_storage_buffer(
295317
element_size(dtype) * numel, allocate_memory);
296318
}

backends/vulkan/runtime/gen_vulkan_spv.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ def buffer_gvec_type(dtype: str, n: int) -> str:
125125

126126
if dtype == "float":
127127
return f"vec{n}"
128+
if dtype == "uint":
129+
return f"uvec{n}"
128130
elif dtype == "half":
129131
return f"f16vec{n}"
130132
elif dtype == "int":

0 commit comments

Comments
 (0)