tensorfs 0.3.87__tar.gz → 0.3.89__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tensorfs might be problematic. Click here for more details.

Files changed (203) hide show
  1. {tensorfs-0.3.87 → tensorfs-0.3.89}/Cargo.lock +3 -3
  2. {tensorfs-0.3.87 → tensorfs-0.3.89}/Cargo.toml +1 -1
  3. {tensorfs-0.3.87 → tensorfs-0.3.89}/PKG-INFO +1 -1
  4. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/download.rs +3 -2
  5. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/tests.rs +19 -0
  6. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/source_download.rs +3 -5
  7. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/API.md +48 -16
  8. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/Cargo.toml +4 -0
  9. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/cuda.rs +2 -0
  10. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/cursor.rs +12 -8
  11. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/device.rs +52 -19
  12. tensorfs-0.3.89/crates/tensorfs-plane/src/faults.rs +94 -0
  13. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/host.rs +166 -58
  14. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/lib.rs +1 -0
  15. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/plane.rs +111 -47
  16. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/tests/gpu.rs +190 -4
  17. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/tests/host_tier.rs +124 -6
  18. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/src/plane.rs +18 -0
  19. {tensorfs-0.3.87 → tensorfs-0.3.89}/pyproject.toml +1 -1
  20. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/plane.py +4 -0
  21. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/plane.pyi +9 -0
  22. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/Cargo.toml +0 -0
  23. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/build.rs +0 -0
  24. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/examples/h3-swiglu-layout.md +0 -0
  25. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/examples/optional-cache-backfill.md +0 -0
  26. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/examples/resident-conversion.md +0 -0
  27. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/examples/resident_conversion_profile.rs +0 -0
  28. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/asset_update.rs +0 -0
  29. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/b64.rs +0 -0
  30. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/ckpt.rs +0 -0
  31. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/conform.rs +0 -0
  32. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/ensure.rs +0 -0
  33. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/fetch.rs +0 -0
  34. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/ingest.rs +0 -0
  35. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/main.rs +0 -0
  36. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/rd.rs +0 -0
  37. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/repo.rs +0 -0
  38. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/snap.rs +0 -0
  39. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/bin/tfs/watch.rs +0 -0
  40. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/cache_roots.rs +0 -0
  41. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/canon.rs +0 -0
  42. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/capability.rs +0 -0
  43. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/catalog/lock.rs +0 -0
  44. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/catalog.rs +0 -0
  45. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/cbor.rs +0 -0
  46. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/checkpoint.rs +0 -0
  47. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/checkpoint_root.rs +0 -0
  48. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/corpus.rs +0 -0
  49. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/adoption.rs +0 -0
  50. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/companion_tests.rs +0 -0
  51. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/estimate.rs +0 -0
  52. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/graft_tests.rs +0 -0
  53. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/group_commit_tests.rs +0 -0
  54. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/history_cost_tests.rs +0 -0
  55. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/part_rows_tests.rs +0 -0
  56. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/progress.rs +0 -0
  57. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/resume_tests.rs +0 -0
  58. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/retention.rs +0 -0
  59. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived/roots.rs +0 -0
  60. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/derived.rs +0 -0
  61. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/descriptors.rs +0 -0
  62. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/disk.rs +0 -0
  63. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/dtype.rs +0 -0
  64. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/durability.rs +0 -0
  65. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ensure/admission.rs +0 -0
  66. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ensure/flight.rs +0 -0
  67. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ensure.rs +0 -0
  68. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/err.rs +0 -0
  69. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/fetch.rs +0 -0
  70. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/filesystem_identity.rs +0 -0
  71. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/fill.rs +0 -0
  72. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/fit.rs +0 -0
  73. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/gc.rs +0 -0
  74. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/header.rs +0 -0
  75. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/home.rs +0 -0
  76. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ids.rs +0 -0
  77. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/carrier.rs +0 -0
  78. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/convert.rs +0 -0
  79. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/custody.rs +0 -0
  80. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/fingerprint.rs +0 -0
  81. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/gguf.rs +0 -0
  82. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/h3_lora.rs +0 -0
  83. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/journal.rs +0 -0
  84. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/mod.rs +0 -0
  85. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/narrow.rs +0 -0
  86. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/preflight.rs +0 -0
  87. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/routes/anima.routes.json +0 -0
  88. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/routes/anima.spec.json +0 -0
  89. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/routes/sdxl.routes.json +0 -0
  90. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/routes/sdxl.spec.json +0 -0
  91. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/routes.rs +0 -0
  92. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/source.rs +0 -0
  93. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/stamp.rs +0 -0
  94. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/ingest/transaction.rs +0 -0
  95. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/jcs.rs +0 -0
  96. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/keyed_roots.rs +0 -0
  97. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/lib.rs +0 -0
  98. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/limits.rs +0 -0
  99. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/machine.rs +0 -0
  100. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/manifest.rs +0 -0
  101. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/meta.rs +0 -0
  102. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/project.rs +0 -0
  103. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/providers.rs +0 -0
  104. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/read.rs +0 -0
  105. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/receipt.rs +0 -0
  106. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/reclaim.rs +0 -0
  107. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/registry.rs +0 -0
  108. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/relation.rs +0 -0
  109. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/repo_cache.rs +0 -0
  110. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/repository.rs +0 -0
  111. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/sha256.rs +0 -0
  112. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/source_artifact.rs +0 -0
  113. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/spec.rs +0 -0
  114. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/staging.rs +0 -0
  115. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/stats.rs +0 -0
  116. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/storage.rs +0 -0
  117. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/store.rs +0 -0
  118. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/api.rs +0 -0
  119. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/decisions.rs +0 -0
  120. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/http.rs +0 -0
  121. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/http_reuse_tests.rs +0 -0
  122. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/hub.rs +0 -0
  123. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/ledger.rs +0 -0
  124. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/memory.rs +0 -0
  125. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/mod.rs +0 -0
  126. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/policy.rs +0 -0
  127. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/pull.rs +0 -0
  128. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/push.rs +0 -0
  129. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/sources.rs +0 -0
  130. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/transport/tests/tail.rs +0 -0
  131. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/unsynced.rs +0 -0
  132. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/src/vectors.rs +0 -0
  133. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/additive_fields.rs +0 -0
  134. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/anima_hf_profile.rs +0 -0
  135. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/as_is.rs +0 -0
  136. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/catalog_owner_probe.c +0 -0
  137. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/checkpoint_roots.rs +0 -0
  138. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/civitai_anima.rs +0 -0
  139. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/civitai_sdxl_profile.rs +0 -0
  140. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/ensure.rs +0 -0
  141. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fd_budget.rs +0 -0
  142. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fd_headroom.rs +0 -0
  143. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fetch_faults.rs +0 -0
  144. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fetch_url_progress.rs +0 -0
  145. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fit.rs +0 -0
  146. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fixtures/repo_apply/blobs.jsonl +0 -0
  147. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fixtures/repo_apply/expected_list.jsonl +0 -0
  148. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fixtures/repo_apply/expected_repository.json +0 -0
  149. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fixtures/repo_apply/expected_rows.jsonl +0 -0
  150. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fixtures/repo_apply/header.cbor +0 -0
  151. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fixtures/repo_apply/manifest.json +0 -0
  152. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/fixtures/repo_apply/mutation.json +0 -0
  153. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/foreign_json.rs +0 -0
  154. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/h3_lora.rs +0 -0
  155. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/h3_swiglu.rs +0 -0
  156. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/home.rs +0 -0
  157. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/hub_tls.rs +0 -0
  158. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/import_tree.rs +0 -0
  159. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/instrument_profiles.rs +0 -0
  160. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/keyed_roots.rs +0 -0
  161. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/liveness.rs +0 -0
  162. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/qwen_image21_profile.rs +0 -0
  163. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/read_plan.rs +0 -0
  164. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/reclaim.rs +0 -0
  165. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/reclaim_run.rs +0 -0
  166. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/repo_cache.rs +0 -0
  167. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/repo_store.rs +0 -0
  168. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/resident_admission.rs +0 -0
  169. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/routed_single_file.rs +0 -0
  170. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/sha256_backends.rs +0 -0
  171. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/sharded_cas.rs +0 -0
  172. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/source_artifacts.rs +0 -0
  173. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/source_plan.rs +0 -0
  174. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/source_prefixes.rs +0 -0
  175. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/source_preflight.rs +0 -0
  176. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/staging.rs +0 -0
  177. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/store_boundaries.rs +0 -0
  178. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/tensor_schema.rs +0 -0
  179. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/transfer_memory.rs +0 -0
  180. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/trust_index.rs +0 -0
  181. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/version.rs +0 -0
  182. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-core/tests/write_through.rs +0 -0
  183. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/bin/g1_vmm.rs +0 -0
  184. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/bin/g2_overlap.rs +0 -0
  185. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/bin/gpu_bench/mod.rs +0 -0
  186. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/io.rs +0 -0
  187. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/src/layout.rs +0 -0
  188. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-plane/tests/common/mod.rs +0 -0
  189. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/Cargo.toml +0 -0
  190. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/src/docs.rs +0 -0
  191. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/src/ensure.rs +0 -0
  192. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/src/errors.rs +0 -0
  193. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/src/ingest.rs +0 -0
  194. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/src/lib.rs +0 -0
  195. {tensorfs-0.3.87 → tensorfs-0.3.89}/crates/tensorfs-py/src/store.rs +0 -0
  196. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/__init__.py +0 -0
  197. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/_derived_channel.py +0 -0
  198. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/_ext.pyi +0 -0
  199. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/_source_channel.py +0 -0
  200. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/_tensors.py +0 -0
  201. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/derived.py +0 -0
  202. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/errors.py +0 -0
  203. {tensorfs-0.3.87 → tensorfs-0.3.89}/python/tensorfs/py.typed +0 -0
@@ -449,7 +449,7 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
449
449
 
450
450
  [[package]]
451
451
  name = "tensorfs-core"
452
- version = "0.3.87"
452
+ version = "0.3.89"
453
453
  dependencies = [
454
454
  "fs2",
455
455
  "libc",
@@ -464,7 +464,7 @@ dependencies = [
464
464
 
465
465
  [[package]]
466
466
  name = "tensorfs-plane"
467
- version = "0.3.87"
467
+ version = "0.3.89"
468
468
  dependencies = [
469
469
  "libc",
470
470
  "libloading",
@@ -474,7 +474,7 @@ dependencies = [
474
474
 
475
475
  [[package]]
476
476
  name = "tensorfs-py"
477
- version = "0.3.87"
477
+ version = "0.3.89"
478
478
  dependencies = [
479
479
  "pyo3",
480
480
  "tensorfs-core",
@@ -3,5 +3,5 @@ resolver = "2"
3
3
  members = ["crates/tensorfs-core", "crates/tensorfs-plane", "crates/tensorfs-py"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.3.87"
6
+ version = "0.3.89"
7
7
  edition = "2021"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensorfs
3
- Version: 0.3.87
3
+ Version: 0.3.89
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Rust
@@ -715,7 +715,8 @@ impl Run<'_> {
715
715
  let job = self.job;
716
716
  let object = &chunk.object;
717
717
  let wanted = &object.grant.object;
718
- // An object that is one chunk is one plain GET.
718
+ // A Hub object that is one chunk is one plain GET. A source request always names its
719
+ // range: a 206 is how the origin says it ranges, and its stand-ins answer only ranges.
719
720
  let whole = chunk.first == 0 && chunk.end == wanted.length;
720
721
  let range = [(
721
722
  "range".to_string(),
@@ -729,7 +730,7 @@ impl Run<'_> {
729
730
  job.credential,
730
731
  job.deadline,
731
732
  ledger,
732
- if whole { &[] } else { &range },
733
+ if whole && job.ranged { &[] } else { &range },
733
734
  &mut |checked, _| hops.push(checked.url()),
734
735
  )?;
735
736
  // A redirect target that refuses is forgotten, and the object's URL asked again.
@@ -3733,6 +3733,25 @@ fn a_source_object_crosses_in_parallel_byte_ranges() {
3733
3733
  assert_eq!(temps(&source.root), 0);
3734
3734
  }
3735
3735
 
3736
+ /// A source object no larger than one request is still asked for by range, as every source
3737
+ /// fetch before 0.3.87 was: an origin that answers only ranges serves it.
3738
+ #[test]
3739
+ fn a_small_source_object_is_asked_for_by_range() {
3740
+ let body = ranged_body(300 << 10);
3741
+ let served = body.clone();
3742
+ let source = Source::new("ranged-small", &body, move |request| {
3743
+ match range_of(request) {
3744
+ Some(_) => partial(&served, request),
3745
+ None => status(400, b"a range is required"),
3746
+ }
3747
+ });
3748
+ let fetched = source.fetch(4, &local_policy()).unwrap();
3749
+
3750
+ assert_eq!(fetched.transferred, source.object.length);
3751
+ assert!(source.held());
3752
+ assert_eq!(source.asked(), vec![format!("bytes=0-{}", body.len() - 1)]);
3753
+ }
3754
+
3736
3755
  /// A source that will not range must still work: the first chunk's ask is answered with
3737
3756
  /// the whole object, and that one request is the object.
3738
3757
  #[test]
@@ -447,11 +447,9 @@ fn a_connection_cut_mid_body_resumes_at_the_byte_it_reached() {
447
447
  let bytes = body(9, 5 * MIB + 1);
448
448
  let length = bytes.len() as u64;
449
449
  // The first delivery answer dies 2.5 MiB in; the next ask must start there.
450
- let origin = Origin::start(vec![(name, bytes)], 0, |request, _| {
451
- match request.path.starts_with("/cdn/") && request.range.is_none() {
452
- true => Act::Cut(5 * MIB / 2),
453
- false => Act::Serve,
454
- }
450
+ let origin = Origin::start(vec![(name, bytes)], 0, |request, _| match request.range {
451
+ Some((0, _)) if request.path.starts_with("/cdn/") => Act::Cut(5 * MIB / 2),
452
+ _ => Act::Serve,
455
453
  });
456
454
  let dir = root("cut");
457
455
  let store = Store::init(&dir).unwrap();
@@ -1,4 +1,4 @@
1
- # tensorfs.plane — Python API (v3, 2026-09-30)
1
+ # tensorfs.plane — Python API (v3.1, 2026-10-02)
2
2
 
3
3
  The weight plane moves bytes; cozy-runtime decides. The plane never measures free memory,
4
4
  never picks victims among equals, never reorders a schedule. It ships inside the `tensorfs`
@@ -48,13 +48,17 @@ ws = p.register(
48
48
  regions, # list[list[str]]: region r = tensor ids "component/key" (all roles)
49
49
  # or exact parts "component/key#role"; every plan part in exactly
50
50
  # one region; a region's parts keep plan order; no empty region
51
- host_fd=None, # adopt a memfd holding this layout (another process's pinned tier)
51
+ host_fd=None, # adopt a memfd holding this layout (another process's pinned tier);
52
+ # every region already Ready in it joins this plane's books at
53
+ # once (claimed, counted in `used`, lowest priority)
52
54
  )
53
55
  ws.name, ws.nbytes # nbytes = layout span (multiple of 2 MiB)
54
56
  ws.regions # [{"index", "offset", "nbytes", "span"}]
55
57
  ws.parts # [{"what": "comp/key#role", "region", "offset", "nbytes"}]
56
- ws.host_fd # the memfd (plane-owned); pass to another process to share the tier
57
- ws.close() # refuses while leases, holds, cursors or views remain
58
+ ws.host_fd # the memfd (plane-owned, an unlocked description); pass it to another
59
+ # process to share the tier
60
+ ws.close() # refuses while leases, holds, cursors or views remain; punches the
61
+ # pinned RAM no other process claims (see Host tier across processes)
58
62
  ```
59
63
 
60
64
  Binding a part: `base[part.offset - region.offset : ... + nbytes]` of the region's bytes,
@@ -111,7 +115,8 @@ lease = p.acquire(ws, device, region, stream, priority=None)
111
115
  lease.ptr, lease.nbytes, lease.region, lease.ring_offset # ring_offset is None for resident leases
112
116
  lease.view() # ONE uint8 DLPack view of the region's bytes (see Views)
113
117
  lease.verify_bytes() # diagnostic: parts whose device bytes differ from the source
114
- # (waits for the copy, reads the store; debugging runs only)
118
+ # (waits for the copy, reads the store; debugging runs only);
119
+ # Invalid after release
115
120
  lease.release() # records the release event on the acquire stream (or pass stream=)
116
121
  with p.acquire(ws, device, region, stream) as lease: ...
117
122
  ```
@@ -227,28 +232,55 @@ attributes: `BudgetExceeded` (`pool`, `requested`, `available`), `Shortfall` (`p
227
232
  `pool == "device"` means the driver itself had no memory left (the budget exceeds what is
228
233
  free): lower it.
229
234
 
230
- **Poison is latched plane-wide**: an ambiguous driver outcome (a failed unmap or rollback, a
231
- driver mapping that disagrees with the books) or a lease dropped unreleased makes every later
232
- call raise `Poisoned` with the first cause; the runtime replaces the executor. Capacity never
233
- poisons (`BudgetExceeded`, `Shortfall` leave the plane usable).
235
+ **A failed copy leaves nothing in flight.** A fill or ring copy that fails after enqueuing part
236
+ of its work is reported (its ticket, `acquire`, `fill_failed`) only after the copy stream has
237
+ drained, so unmapping, dropping or closing what it touched is safe at once. A failure the
238
+ stream cannot drain is `Poisoned`.
239
+
240
+ **Poison is latched plane-wide**: an ambiguous driver outcome (a failed unmap or rollback, an
241
+ undrainable copy failure, a driver mapping that disagrees with the books) or a lease dropped
242
+ unreleased makes every later call raise `Poisoned` with the first cause; the runtime replaces
243
+ the executor. A poisoned plane never unmaps, unregisters or frees a range (copies may still
244
+ touch it): `ws.close()`, `cur.close()` and `p.close()` raise `Poisoned` and the process keeps
245
+ the ranges until it exits. Capacity never poisons (`BudgetExceeded`, `Shortfall` leave the
246
+ plane usable).
234
247
 
235
248
  ## Host tier across processes
236
249
 
237
250
  - One memfd per weight set, laid out exactly like the weight set, with a state page at its
238
- end: a layout digest and one Ready word per region. That page IS the shared index.
251
+ end: a layout digest, one Ready word and the extent of each region. That page IS the shared
252
+ index.
253
+ - **Claims.** A process holds a shared OFD lock on a region's word for as long as the region is
254
+ filling or ready in its books. Evicting, dropping or closing ends this process's claim; the
255
+ last claimant punches the region's RAM. So pinned RAM is always inside some live budget, a
256
+ closed set does not stay resident because another process kept the fd, and no process loses
257
+ pages it still has registered. The kernel drops a dead process's claims.
239
258
  - `register(..., host_fd=fd)` in another process (or a replacement executor) reopens the fd
240
- (its own open file description), refuses a different layout digest, and adopts every
241
- region whose Ready word is set on its next `want("pinned")` — registering it, reading
242
- nothing (`stats()["host"]["fill_bytes"]` unchanged). The digest covers the plan's parts,
259
+ (its own open file description), refuses a different layout digest, and claims every region
260
+ whose Ready word is set — registering it, reading nothing (`stats()["host"]["fill_bytes"]`
261
+ unchanged) — at the lowest priority, counted in `used`. The digest covers the plan's parts,
243
262
  their object ranges and the region grouping: register with the same plan and regions.
263
+ - `ws.host_fd` is a separate, never-locked description: a process that keeps it (or a dup) keeps
264
+ the memfd alive but no claim.
265
+ - **Keeping a tier without a plane** (the Worker between executors): `h = plane.hold_tier(fd)`
266
+ claims every region (one shared lock over the whole file, on a new description); while it is
267
+ held, no plane eviction or close punches the tier. `plane.release_tier(h)` closes it and punches
268
+ every Ready region no plane claims, returning the bytes punched. Bound held tiers with the
269
+ holder's own budget (`os.fstat(fd).st_blocks * 512` is the memfd's RAM).
244
270
  - A host-only `Plane(devices=[])` (never loads libcuda) can fill a tier before any executor
245
271
  holds a GPU; executors adopt and register it.
246
- - Eviction punches the region's hole under an exclusive OFD lock that fills hold shared:
247
- never while another process fills it. Contents are immutable, so a process still DMA-ing
248
- from pages it registered before a punch reads the same bytes.
272
+ - A memfd from a plane before v3.1 (state page `TFSPLN01`) is a different layout: adopting it
273
+ raises `Invalid`; register a fresh one.
249
274
 
250
275
  ## Changelog
251
276
 
277
+ - v3.1 2026-10-02 (Xid 31; W3 run 2675): a failed copy is reported only after its stream drained;
278
+ an undrainable one poisons; a poisoned plane never unmaps (close raises `Poisoned`).
279
+ `verify_bytes()` after release raises `Invalid`. Pinned-tier claims: close and eviction punch
280
+ RAM no other process claims, `register(host_fd=)` claims what the memfd already holds,
281
+ `plane.hold_tier` / `plane.release_tier` for the Worker. The state page gains region extents
282
+ (`TFSPLN02`).
283
+
252
284
  - v3 2026-09-30 (proving-cpu.md: fine regions, spread sets): streaming uses a byte ring
253
285
  instead of fixed slots. `stream(..., ring_bytes=None)`; `cur.ring_ptr`, `cur.ring_nbytes`,
254
286
  `cur.ring_view()` replace `slot_ptrs`, `slot_nbytes`, `slot_view(i)`; `lease.ring_offset`
@@ -11,3 +11,7 @@ libc = "0.2"
11
11
  # libcuda is dlopen'd at first use: the workspace builds and tests with no CUDA toolkit.
12
12
  libloading = "0.9"
13
13
  thiserror = "2"
14
+
15
+ [features]
16
+ # Test-only fault points on the copy path (tests/gpu.rs drives them).
17
+ faults = []
@@ -105,6 +105,7 @@ pub struct Driver {
105
105
  pub primary_ctx_retain: unsafe extern "C" fn(*mut CUcontext, CUdevice) -> CUresult,
106
106
  pub ctx_get_current: F<*mut CUcontext>,
107
107
  pub ctx_set_current: F<CUcontext>,
108
+ pub ctx_synchronize: unsafe extern "C" fn() -> CUresult,
108
109
  pub stream_create: unsafe extern "C" fn(*mut CUstream, c_uint) -> CUresult,
109
110
  pub stream_destroy: F<CUstream>,
110
111
  pub stream_synchronize: F<CUstream>,
@@ -187,6 +188,7 @@ impl Driver {
187
188
  primary_ctx_retain: load!(lib, b"cuDevicePrimaryCtxRetain"),
188
189
  ctx_get_current: load!(lib, b"cuCtxGetCurrent"),
189
190
  ctx_set_current: load!(lib, b"cuCtxSetCurrent"),
191
+ ctx_synchronize: load!(lib, b"cuCtxSynchronize"),
190
192
  stream_create: load!(lib, b"cuStreamCreate"),
191
193
  stream_destroy: load!(lib, b"cuStreamDestroy_v2"),
192
194
  stream_synchronize: load!(lib, b"cuStreamSynchronize"),
@@ -93,6 +93,9 @@ impl Cur {
93
93
  /// Queue copies for streamed positions, in order, while the window and the ring allow.
94
94
  fn pump(inner: &Arc<Inner>, c: &mut Core, id: u64) -> Result<()> {
95
95
  loop {
96
+ if c.poisoned.is_some() {
97
+ return Ok(()); // nothing new goes to a device whose state is ambiguous
98
+ }
96
99
  let cur = c.cursors.get_mut(&id).ok_or(Error::Closed)?;
97
100
  let k = cur.next_submit;
98
101
  if cur.orphaned || k >= cur.streamed_total() || k - cur.done >= cur.window {
@@ -165,6 +168,9 @@ fn submit(inner: &Arc<Inner>, c: &mut Core, id: u64, k: u64, off: u64, waits: Ve
165
168
  bytes: cp.bytes,
166
169
  });
167
170
  }
171
+ if let Err(e) = &res {
172
+ c.latch(e);
173
+ }
168
174
  if let Some(cur) = c.cursors.get_mut(&id) {
169
175
  cur.inflight -= 1;
170
176
  cur.ready.insert(k, res.map(|cp| cp.ready));
@@ -213,18 +219,16 @@ fn reap(inner: &Arc<Inner>, c: &mut Core, id: u64) {
213
219
  }
214
220
  }
215
221
 
216
- /// Unmap a cursor's ring and return its holds. No lease, view or copy in flight remains.
222
+ /// Unmap a cursor's ring and return its holds. No lease, view or copy in flight remains (a
223
+ /// failed copy is drained before it is reported). A poisoned plane keeps the ring mapped.
217
224
  fn finish(inner: &Arc<Inner>, c: &mut Core, id: u64) -> Result<()> {
225
+ c.check()?;
218
226
  let cur = c.cursors.remove(&id).ok_or(Error::Closed)?;
219
227
  let d = cur.dev;
220
228
  let _g = inner.devices[d].bind()?;
221
- for e in cur.ready.values().flatten() {
222
- e.sync()?;
223
- }
224
- for p in &cur.placed {
225
- if let Some(Some(e)) = &p.freed {
226
- e.sync()?;
227
- }
229
+ let freed = cur.placed.iter().filter_map(|p| p.freed.as_ref().and_then(Option::as_ref));
230
+ if let Err(e) = cur.ready.values().flatten().chain(freed).try_for_each(|e| e.sync()) {
231
+ return Err(c.poison(format!("waiting for a ring's copies and readers failed: {e}")));
228
232
  }
229
233
  if cur.ring_len > 0 {
230
234
  if let Err(e) = device::unmap_span(cur.ring_base, cur.ring_len) {
@@ -489,6 +489,10 @@ struct Waiter {
489
489
  cv: Condvar,
490
490
  }
491
491
 
492
+ /// One job on the mover's stream. `Err` means nothing this job enqueued is still in flight and
493
+ /// no reader still writes a bounce: a failed copy is drained before it is reported, so no
494
+ /// caller unmaps, unregisters or reuses a range a copy still touches. A drain that itself fails
495
+ /// is ambiguous device state: `Poisoned`.
492
496
  fn run_copy(
493
497
  m: &MoverCtx,
494
498
  stream: CUstream,
@@ -497,6 +501,28 @@ fn run_copy(
497
501
  dst: u64,
498
502
  len: u64,
499
503
  src: CopySrc,
504
+ ) -> Result<Copied> {
505
+ let r = enqueue_copy(m, stream, bounces, waits, dst, len, src);
506
+ let Err(e) = r else { return r };
507
+ let d = cuda::driver()?;
508
+ // SAFETY: our own stream.
509
+ let drained = crate::faults::hit("drain").and_then(|_| {
510
+ cuda::check("cuStreamSynchronize", unsafe { (d.stream_synchronize)(stream) })
511
+ });
512
+ match drained {
513
+ Ok(()) => Err(e),
514
+ Err(drain) => Err(Error::Poisoned(format!("a failed copy ({e}) could not be drained: {drain}"))),
515
+ }
516
+ }
517
+
518
+ fn enqueue_copy(
519
+ m: &MoverCtx,
520
+ stream: CUstream,
521
+ bounces: &mut [Bounce],
522
+ waits: Vec<EvRef>,
523
+ dst: u64,
524
+ len: u64,
525
+ src: CopySrc,
500
526
  ) -> Result<Copied> {
501
527
  let d = cuda::driver()?;
502
528
  let start = m.events.get(true)?;
@@ -511,11 +537,13 @@ fn run_copy(
511
537
  match src {
512
538
  CopySrc::Host(p) => {
513
539
  wait_all(&waits)?;
540
+ crate::faults::gate("copy", stream)?;
514
541
  start.record(stream)?;
515
542
  // SAFETY: `p` covers `len` bytes of the pinned tier, kept alive by the books.
516
543
  cuda::check("cuMemcpyHtoDAsync", unsafe {
517
544
  (d.memcpy_htod_async)(dst, p as *const libc::c_void, len as usize, stream)
518
545
  })?;
546
+ crate::faults::hit("host-copy-recorded")?;
519
547
  ready.record(stream)?;
520
548
  Ok(Copied { ready, start, bytes: len, from_host: true })
521
549
  }
@@ -528,14 +556,16 @@ fn run_copy(
528
556
  let mut inflight: VecDeque<(u64, usize, Arc<Waiter>)> = VecDeque::new();
529
557
  let mut next = 0usize;
530
558
  // The slot's previous readers first: the stream waits, the host keeps reading.
531
- wait_all(&waits)?;
559
+ let mut failed = wait_all(&waits).and_then(|_| crate::faults::gate("copy", stream)).err();
532
560
  let mut first = true;
533
- let mut failed = None;
534
561
  loop {
535
562
  while failed.is_none() && inflight.len() < bounces.len() && next < nchunks {
536
563
  let b = next % bounces.len();
537
564
  if let Some(last) = bounces[b].last.take() {
538
- last.sync()?;
565
+ if let Err(e) = last.sync() {
566
+ failed = Some(e);
567
+ break;
568
+ }
539
569
  }
540
570
  let c0 = next as u64 * cap;
541
571
  let c1 = (c0 + cap).min(len);
@@ -568,31 +598,34 @@ fn run_copy(
568
598
  while g.is_none() {
569
599
  g = w.cv.wait(g).unwrap();
570
600
  }
571
- // After a failure keep draining: readers may still write the bounces.
601
+ // After any failure keep draining: readers may still write the bounces.
572
602
  if let Err(e) = g.take().unwrap() {
573
603
  failed.get_or_insert(e);
574
604
  }
575
605
  if failed.is_some() {
576
606
  continue;
577
607
  }
578
- if first {
579
- start.record(stream)?;
580
- first = false;
608
+ let mut copy = || -> Result<()> {
609
+ if first {
610
+ start.record(stream)?;
611
+ first = false;
612
+ }
613
+ crate::faults::hit("staged-copy")?;
614
+ let n = cap.min(len - c0);
615
+ // SAFETY: the bounce holds the chunk; pinned host memory.
616
+ cuda::check("cuMemcpyHtoDAsync", unsafe {
617
+ (d.memcpy_htod_async)(dst + c0, bounces[b].ptr as *const libc::c_void, n as usize, stream)
618
+ })?;
619
+ let e = m.events.get(false)?;
620
+ e.record(stream)?;
621
+ bounces[b].last = Some(e);
622
+ Ok(())
623
+ };
624
+ if let Err(e) = copy() {
625
+ failed = Some(e);
581
626
  }
582
- let n = cap.min(len - c0);
583
- // SAFETY: the bounce holds the chunk; pinned host memory.
584
- cuda::check("cuMemcpyHtoDAsync", unsafe {
585
- (d.memcpy_htod_async)(dst + c0, bounces[b].ptr as *const libc::c_void, n as usize, stream)
586
- })?;
587
- let e = m.events.get(false)?;
588
- e.record(stream)?;
589
- bounces[b].last = Some(e);
590
627
  }
591
628
  if let Some(e) = failed {
592
- // Chunks before the failure are still writing the region: drain them, so an
593
- // Invalid region never has a copy in flight when it is unmapped.
594
- ready.record(stream)?;
595
- ready.sync()?;
596
629
  return Err(e);
597
630
  }
598
631
  if first {
@@ -0,0 +1,94 @@
1
+ //! Fault points on the copy path, armed only by tests (cargo feature `faults`). Without the
2
+ //! feature every point is a no-op.
3
+
4
+ #[cfg(feature = "faults")]
5
+ mod imp {
6
+ use std::sync::atomic::{AtomicBool, Ordering};
7
+ use std::sync::{Arc, Mutex};
8
+
9
+ use crate::cuda::{self, CUstream};
10
+
11
+ static ARMED: Mutex<Vec<(&'static str, u64)>> = Mutex::new(Vec::new());
12
+ static GATES: Mutex<Vec<(&'static str, Arc<AtomicBool>)>> = Mutex::new(Vec::new());
13
+
14
+ /// Fail the `n`th (1-based) next pass through `point` as a driver out-of-memory. Replaces
15
+ /// any earlier arming of `point`.
16
+ pub fn arm(point: &'static str, n: u64) {
17
+ let mut a = ARMED.lock().unwrap();
18
+ a.retain(|(p, _)| *p != point);
19
+ a.push((point, n));
20
+ }
21
+
22
+ pub(crate) fn hit(point: &'static str) -> crate::Result<()> {
23
+ let mut armed = ARMED.lock().unwrap();
24
+ let Some(i) = armed.iter().position(|(p, _)| *p == point) else { return Ok(()) };
25
+ armed[i].1 -= 1;
26
+ if armed[i].1 > 0 {
27
+ return Ok(());
28
+ }
29
+ armed.remove(i);
30
+ Err(crate::Error::Cuda { op: point, code: cuda::ERROR_OUT_OF_MEMORY, name: "injected".into() })
31
+ }
32
+
33
+ /// Holds the next copy job's stream at `point` on the device until opened (or dropped).
34
+ pub struct Gate(Arc<AtomicBool>);
35
+ impl Gate {
36
+ pub fn open(&self) {
37
+ self.0.store(true, Ordering::Release);
38
+ }
39
+ pub fn is_open(&self) -> bool {
40
+ self.0.load(Ordering::Acquire)
41
+ }
42
+ pub fn opener(&self) -> impl FnOnce() + Send + 'static {
43
+ let f = self.0.clone();
44
+ move || f.store(true, Ordering::Release)
45
+ }
46
+ }
47
+ impl Drop for Gate {
48
+ fn drop(&mut self) {
49
+ self.open();
50
+ }
51
+ }
52
+
53
+ pub fn arm_gate(point: &'static str) -> Gate {
54
+ let f = Arc::new(AtomicBool::new(false));
55
+ GATES.lock().unwrap().push((point, f.clone()));
56
+ Gate(f)
57
+ }
58
+
59
+ pub(crate) fn gate(point: &'static str, stream: CUstream) -> crate::Result<()> {
60
+ let f = {
61
+ let mut g = GATES.lock().unwrap();
62
+ let Some(i) = g.iter().position(|(p, _)| *p == point) else { return Ok(()) };
63
+ g.remove(i).1
64
+ };
65
+ extern "C" fn hold(p: *mut std::ffi::c_void) {
66
+ // SAFETY: the Arc leaked below, reclaimed exactly once here.
67
+ let f = unsafe { Arc::from_raw(p as *const AtomicBool) };
68
+ while !f.load(Ordering::Acquire) {
69
+ std::thread::sleep(std::time::Duration::from_millis(1));
70
+ }
71
+ }
72
+ let d = cuda::driver()?;
73
+ let p = Arc::into_raw(f) as *mut std::ffi::c_void;
74
+ // SAFETY: our stream; the host function only waits on the flag.
75
+ cuda::check("cuLaunchHostFunc", unsafe { (d.launch_host_func)(stream, hold, p) })
76
+ }
77
+ }
78
+
79
+ #[cfg(feature = "faults")]
80
+ pub use imp::{arm, arm_gate, Gate};
81
+ #[cfg(feature = "faults")]
82
+ pub(crate) use imp::{gate, hit};
83
+
84
+ #[cfg(not(feature = "faults"))]
85
+ #[inline(always)]
86
+ pub(crate) fn hit(_point: &'static str) -> crate::Result<()> {
87
+ Ok(())
88
+ }
89
+
90
+ #[cfg(not(feature = "faults"))]
91
+ #[inline(always)]
92
+ pub(crate) fn gate(_point: &'static str, _stream: crate::cuda::CUstream) -> crate::Result<()> {
93
+ Ok(())
94
+ }