nbxtensor 0.1.7__tar.gz → 0.1.8__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.
Files changed (376) hide show
  1. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/CHANGELOG.md +31 -0
  2. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/PKG-INFO +1 -1
  3. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/API.md +49 -1
  4. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/pyproject.toml +1 -1
  5. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/__init__.py +1 -1
  6. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m4_pro.yml +8 -4
  7. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/frozen_plan.py +5 -5
  8. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/metal_device.py +31 -1
  9. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/metal_dispatch.py +3 -0
  10. nbxtensor-0.1.8/src/nbxtensor/backend/metal_profile.py +167 -0
  11. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/replay_graph.py +53 -17
  12. nbxtensor-0.1.8/src/nbxtensor/device.py +140 -0
  13. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/__init__.py +17 -0
  14. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/allocator.py +8 -3
  15. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/shadow.py +30 -5
  16. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/vmm.py +23 -21
  17. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/autotune_cache.py +2 -3
  18. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/autotune_certified.py +4 -0
  19. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/elementwise_wrappers.py +6 -7
  20. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/fused_moe.py +12 -15
  21. nbxtensor-0.1.8/src/nbxtensor/profile.py +95 -0
  22. nbxtensor-0.1.8/tests/conftest.py +4 -0
  23. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/tools/scatter_scan.py +3 -0
  24. nbxtensor-0.1.7/src/nbxtensor/device.py +0 -79
  25. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/.github/PULL_REQUEST_TEMPLATE/certificate.md +0 -0
  26. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/.github/workflows/cla.yml +0 -0
  27. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/.gitignore +0 -0
  28. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/CONTRIBUTING.md +0 -0
  29. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/LICENSE +0 -0
  30. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/NOTICE +0 -0
  31. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/README.md +0 -0
  32. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/THIRD_PARTY_NOTICES.md +0 -0
  33. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/assets/logo.png +0 -0
  34. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/BACKENDS.md +0 -0
  35. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/api_undocumented.txt +0 -0
  36. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/certified-autotune-method.md +0 -0
  37. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/design/ALLOCATOR.md +0 -0
  38. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/design/COST.md +0 -0
  39. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/design/DESIGN.md +0 -0
  40. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/device_file_template.yml +0 -0
  41. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/device_keys.txt +0 -0
  42. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/history/INVENTORY.md +0 -0
  43. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/history/MIGRATION.md +0 -0
  44. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/history/migration_list.tsv +0 -0
  45. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/replay-recording-in-a-one-shot-request.md +0 -0
  46. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/tensor-cores-through-linear-layouts.md +0 -0
  47. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/docs/triton_cpu_install.md +0 -0
  48. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/__main__.py +0 -0
  49. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/__init__.py +0 -0
  50. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/capabilities.py +0 -0
  51. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/cpu/__init__.py +0 -0
  52. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/cpu/blas.py +0 -0
  53. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/cpu/pool.py +0 -0
  54. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/cpu_backend.py +0 -0
  55. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/device_facts.py +0 -0
  56. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/device_files.py +0 -0
  57. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/device_measure.py +0 -0
  58. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/device_names.py +0 -0
  59. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/amd/cdna.yml +0 -0
  60. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/amd/cdna2.yml +0 -0
  61. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/amd/cdna3.yml +0 -0
  62. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/amd/cdna4.yml +0 -0
  63. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/amd/rdna3.yml +0 -0
  64. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/amd/rdna4.yml +0 -0
  65. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m1.yml +0 -0
  66. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m1_max.yml +0 -0
  67. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m1_pro.yml +0 -0
  68. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m1_ultra.yml +0 -0
  69. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m2.yml +0 -0
  70. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m2_max.yml +0 -0
  71. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m2_pro.yml +0 -0
  72. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m2_ultra.yml +0 -0
  73. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m3.yml +0 -0
  74. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m3_max.yml +0 -0
  75. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m3_pro.yml +0 -0
  76. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m3_ultra.yml +0 -0
  77. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m4.yml +0 -0
  78. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m4_max.yml +0 -0
  79. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m5.yml +0 -0
  80. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m5_max.yml +0 -0
  81. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m5_pro.yml +0 -0
  82. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m5_ultra.yml +0 -0
  83. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_m6.yml +0 -0
  84. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/apple/apple_silicon.yml +0 -0
  85. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/arl_h.yml +0 -0
  86. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/arl_s.yml +0 -0
  87. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/bmg.yml +0 -0
  88. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/dg2.yml +0 -0
  89. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/lnl.yml +0 -0
  90. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/mtl.yml +0 -0
  91. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/ptl_h.yml +0 -0
  92. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/ptl_u.yml +0 -0
  93. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/pvc.yml +0 -0
  94. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/wcl.yml +0 -0
  95. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/intel/xe_lp.yml +0 -0
  96. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/nvidia/ampere.yml +0 -0
  97. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/nvidia/hopper.yml +0 -0
  98. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/devices/nvidia/volta.yml +0 -0
  99. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/faults.py +0 -0
  100. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/host_memory.py +0 -0
  101. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/install_help.py +0 -0
  102. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/install_metal.py +0 -0
  103. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/install_steps.yml +0 -0
  104. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/launcher.py +0 -0
  105. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/launcher_contract.py +0 -0
  106. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/level_zero.py +0 -0
  107. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/level_zero_driver.py +0 -0
  108. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/libnames.py +0 -0
  109. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/metal_backend.py +0 -0
  110. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/process_memory.py +0 -0
  111. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/runtime.py +0 -0
  112. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/backend/triton_ext_driver.py +0 -0
  113. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/__init__.py +0 -0
  114. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/convert.py +0 -0
  115. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/dtypes.yml +0 -0
  116. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/itemsize.py +0 -0
  117. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/nbx_dtype.py +0 -0
  118. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/operands.py +0 -0
  119. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/outputs.py +0 -0
  120. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/policy.py +0 -0
  121. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/policy.yml +0 -0
  122. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/dtype/promotion.py +0 -0
  123. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/host.py +0 -0
  124. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/inspection.py +0 -0
  125. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/interop/__init__.py +0 -0
  126. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/interop/dlpack.py +0 -0
  127. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/interop/handoff.py +0 -0
  128. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/io/__init__.py +0 -0
  129. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/io/constants.py +0 -0
  130. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/io/mapped_shards.py +0 -0
  131. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/io/read_rate.py +0 -0
  132. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/io/safetensors.py +0 -0
  133. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/arena.py +0 -0
  134. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/block_upload.py +0 -0
  135. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/deferred_frees.py +0 -0
  136. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/device_memory.py +0 -0
  137. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/device_transfer.py +0 -0
  138. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/expert_slots.py +0 -0
  139. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/host_spill.py +0 -0
  140. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/kv_host_pages.py +0 -0
  141. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/kv_host_tier.py +0 -0
  142. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/kv_session.py +0 -0
  143. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/layout.py +0 -0
  144. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/memory_pool.py +0 -0
  145. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/metal.py +0 -0
  146. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/oom_advice.py +0 -0
  147. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/paged_kv.py +0 -0
  148. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/pages.py +0 -0
  149. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/pointer_tables.py +0 -0
  150. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/pool.py +0 -0
  151. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/slab.py +0 -0
  152. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/slot_stores.py +0 -0
  153. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/step_stabilizer.py +0 -0
  154. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/to_device_census.py +0 -0
  155. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/trace_replay.py +0 -0
  156. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/memory/traces/sana-video-2b-720p.16g.2026-11-02.tsv +0 -0
  157. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/__init__.py +0 -0
  158. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/_autotune_policy.py +0 -0
  159. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/_common.py +0 -0
  160. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/_configs.py +0 -0
  161. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/_cost.py +0 -0
  162. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/abs.py +0 -0
  163. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/adaptive_avg_pool2d.py +0 -0
  164. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/add.py +0 -0
  165. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/addcdiv.py +0 -0
  166. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/addcmul.py +0 -0
  167. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/addmv_op.py +0 -0
  168. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/addr.py +0 -0
  169. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/all_reduce.py +0 -0
  170. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/amax.py +0 -0
  171. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/any_reduce.py +0 -0
  172. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/arange_op.py +0 -0
  173. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/argmax.py +0 -0
  174. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/argmin.py +0 -0
  175. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/atan2.py +0 -0
  176. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/attention_wrappers.py +0 -0
  177. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/autotune_bucket.py +0 -0
  178. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/autotune_harness.py +0 -0
  179. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/autotune_refusals.py +0 -0
  180. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/autotune_settings.py +0 -0
  181. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/avg_pool2d.py +0 -0
  182. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/axis_slices.py +0 -0
  183. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/baddbmm_op.py +0 -0
  184. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/batch_norm.py +0 -0
  185. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/binary_strided.py +0 -0
  186. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/bitwise_and.py +0 -0
  187. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/bitwise_left_shift.py +0 -0
  188. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/bitwise_not.py +0 -0
  189. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/bitwise_or.py +0 -0
  190. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/bitwise_right_shift.py +0 -0
  191. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/bucketize.py +0 -0
  192. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/cat_op.py +0 -0
  193. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/celu.py +0 -0
  194. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/certified_index.py +0 -0
  195. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/clamp.py +0 -0
  196. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/clamp_min.py +0 -0
  197. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/conv2d.py +0 -0
  198. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/conv2d_m8n8k4.py +0 -0
  199. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/conv_depthwise2d.py +0 -0
  200. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/conv_transpose2d.py +0 -0
  201. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/conv_wrappers.py +0 -0
  202. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/copy.py +0 -0
  203. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/copy_op.py +0 -0
  204. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/cos.py +0 -0
  205. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/count_nonzero.py +0 -0
  206. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/cross_entropy.py +0 -0
  207. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/cummax.py +0 -0
  208. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/cummin.py +0 -0
  209. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/cumsum.py +0 -0
  210. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/decode_attn_vec.py +0 -0
  211. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/depthwise_conv2d.py +0 -0
  212. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/dequant_gemv.py +0 -0
  213. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/dft.py +0 -0
  214. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/dispatch.py +0 -0
  215. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/div.py +0 -0
  216. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/dot_op.py +0 -0
  217. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/dropout.py +0 -0
  218. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/dtype_convert.py +0 -0
  219. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/elementwise_launch.py +0 -0
  220. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/elu.py +0 -0
  221. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/embedding.py +0 -0
  222. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/embedding_pool.py +0 -0
  223. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/eq.py +0 -0
  224. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/erf.py +0 -0
  225. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/exp.py +0 -0
  226. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/exp2.py +0 -0
  227. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/fft_op.py +0 -0
  228. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/fill_op.py +0 -0
  229. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/flash_attention.py +0 -0
  230. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/flash_attention_m8n8k4.py +0 -0
  231. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/flash_decode.py +0 -0
  232. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/flip_op.py +0 -0
  233. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/floor.py +0 -0
  234. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/full_op.py +0 -0
  235. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/fused_moe_m8n8k4.py +0 -0
  236. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/fused_upsample_conv.py +0 -0
  237. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/gather_op.py +0 -0
  238. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/ge.py +0 -0
  239. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/gelu.py +0 -0
  240. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/gemv_vec.py +0 -0
  241. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/glu.py +0 -0
  242. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/grid_sampler.py +0 -0
  243. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/group_norm_tiled.py +0 -0
  244. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/groupnorm.py +0 -0
  245. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/gt.py +0 -0
  246. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/hardsigmoid.py +0 -0
  247. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/hardswish.py +0 -0
  248. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/host_decode_partial.py +0 -0
  249. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/im2col.py +0 -0
  250. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/index_add.py +0 -0
  251. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/index_put_op.py +0 -0
  252. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/index_select.py +0 -0
  253. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/index_wrappers.py +0 -0
  254. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/isfinite.py +0 -0
  255. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/isinf.py +0 -0
  256. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/isnan.py +0 -0
  257. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/launch_keys.py +0 -0
  258. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/launch_observer.py +0 -0
  259. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/layernorm.py +0 -0
  260. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/le.py +0 -0
  261. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/leaky_relu.py +0 -0
  262. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/lerp.py +0 -0
  263. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/linalg_wrappers.py +0 -0
  264. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/linspace_op.py +0 -0
  265. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/log.py +0 -0
  266. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/log_sigmoid.py +0 -0
  267. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/logical_and.py +0 -0
  268. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/logical_not.py +0 -0
  269. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/logical_or.py +0 -0
  270. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/logical_xor.py +0 -0
  271. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/loss_wrappers.py +0 -0
  272. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/lt.py +0 -0
  273. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/masked_fill.py +0 -0
  274. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/matmul.py +0 -0
  275. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/matmul_m8n8k4.py +0 -0
  276. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/max_pool2d.py +0 -0
  277. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/max_pool3d.py +0 -0
  278. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/max_reduce.py +0 -0
  279. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/maximum.py +0 -0
  280. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/mean.py +0 -0
  281. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/min_reduce.py +0 -0
  282. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/minimum.py +0 -0
  283. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/mish.py +0 -0
  284. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/mma_m8n8k4.py +0 -0
  285. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/moe_align.py +0 -0
  286. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/moe_decode_vec.py +0 -0
  287. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/moe_device_residency.py +0 -0
  288. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/moe_fused.py +0 -0
  289. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/moe_multi_device.py +0 -0
  290. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/moe_wrappers.py +0 -0
  291. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/mse_loss.py +0 -0
  292. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/mul.py +0 -0
  293. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/nan_to_num.py +0 -0
  294. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/ne.py +0 -0
  295. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/neg.py +0 -0
  296. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/nllloss.py +0 -0
  297. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/nonzero.py +0 -0
  298. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/nonzero_op.py +0 -0
  299. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/norm_wrappers.py +0 -0
  300. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/ones_op.py +0 -0
  301. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/oracles/__init__.py +0 -0
  302. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/oracles/attention_fp64.py +0 -0
  303. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/oracles/conv2d_fp64.py +0 -0
  304. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/oracles/fp64.py +0 -0
  305. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/pad_op.py +0 -0
  306. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/paged_decode_attn.py +0 -0
  307. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/pixel_shuffle.py +0 -0
  308. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/pixel_unshuffle.py +0 -0
  309. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/pow.py +0 -0
  310. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/prod.py +0 -0
  311. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/rand_op.py +0 -0
  312. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/random_wrappers.py +0 -0
  313. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/reciprocal.py +0 -0
  314. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/reduction_wrappers.py +0 -0
  315. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/relu.py +0 -0
  316. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/remainder.py +0 -0
  317. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/repeat_interleave.py +0 -0
  318. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/repeat_op.py +0 -0
  319. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/residual_chain.py +0 -0
  320. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/rmsnorm.py +0 -0
  321. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/rope.py +0 -0
  322. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/rsqrt.py +0 -0
  323. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/scaled_softmax.py +0 -0
  324. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/scatter_op.py +0 -0
  325. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/screen_oracle.py +0 -0
  326. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/selu.py +0 -0
  327. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/shape_wrappers.py +0 -0
  328. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/sigmoid.py +0 -0
  329. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/silu.py +0 -0
  330. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/sin.py +0 -0
  331. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/softmax.py +0 -0
  332. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/softplus.py +0 -0
  333. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/sort_op.py +0 -0
  334. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/spectral_wrappers.py +0 -0
  335. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/sqrt.py +0 -0
  336. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/stack_op.py +0 -0
  337. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/std.py +0 -0
  338. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/strided_copy.py +0 -0
  339. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/sub.py +0 -0
  340. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/sum.py +0 -0
  341. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/tan.py +0 -0
  342. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/tanh.py +0 -0
  343. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/threshold.py +0 -0
  344. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/tiles.py +0 -0
  345. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/tiling.yml +0 -0
  346. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/tiling_policy.py +0 -0
  347. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/tiling_sizes.py +0 -0
  348. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/token_bitmask.py +0 -0
  349. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/token_filters.py +0 -0
  350. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/topk.py +0 -0
  351. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/trace_op.py +0 -0
  352. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/tril.py +0 -0
  353. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/triu.py +0 -0
  354. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/unfold_op.py +0 -0
  355. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/unique_op.py +0 -0
  356. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/upsample_bilinear2d.py +0 -0
  357. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/upsample_nearest2d.py +0 -0
  358. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/upsample_nearest3d.py +0 -0
  359. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/var.py +0 -0
  360. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/vector_norm.py +0 -0
  361. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/weight_norm.py +0 -0
  362. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/where.py +0 -0
  363. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/wrappers.py +0 -0
  364. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/ops/zeros_op.py +0 -0
  365. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/quant/__init__.py +0 -0
  366. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/quant/quantized_tensor.py +0 -0
  367. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/random/__init__.py +0 -0
  368. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/random/mt_randn.py +0 -0
  369. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/random/rng_pin.py +0 -0
  370. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/random/rng_stream.py +0 -0
  371. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/random/seeded_draw.py +0 -0
  372. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/shape/__init__.py +0 -0
  373. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/tensor.py +0 -0
  374. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/src/nbxtensor/terminal.py +0 -0
  375. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/tools/device_key_census.py +0 -0
  376. {nbxtensor-0.1.7 → nbxtensor-0.1.8}/tools/device_key_trace.py +0 -0
@@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.8] - 2026-11-15
11
+
12
+ ### Added
13
+ - `nbxtensor.memory.peak_memory_allocated(device)`, `reset_peak_memory(device)` and `pool_stats()`: the allocator's
14
+ peak, its restart and the pool's counters through the public API.
15
+ - `nbxtensor.device.target_name()` (`<backend>-<arch>`, as measured and certified settings are keyed),
16
+ `declare_target(maker, capability)` and `install_shadow(devices)` (a card-less process that forms every launch key a
17
+ run would, refused with `DevicesVisible` while a device is in sight); `TargetNotDeclarable` names a target that
18
+ cannot be formed from a capability number.
19
+ - `nbxtensor.profile.kernel_times()`: where a real run's GPU time goes on Metal, kernel by kernel (and the copies as
20
+ one row). Inside it every launch runs alone and is timed on the GPU at its own boundaries: the table ranks kernels;
21
+ it is not the production speed, and its header says so. The output bytes do not change.
22
+
23
+ ### Changed
24
+ - The replay runs as CUDA graphs wherever the backend offers them, on one card too: a plan recorded on one card (the
25
+ record naming its card, a device sync on that card) is captured as one graph; a plan that crosses cards is refused by
26
+ name before any capture, and a refused capture keeps the direct replay for its bucket. The opt-in switch
27
+ (`NBX_REPLAY_GRAPH`) is gone; the output bytes are identical.
28
+ - The fused SwiGLU with split gate and up tensors runs as one element-wise launch at the element-wise class's certified
29
+ tile (its fixed 16 x 1024 tile spilled): the same bytes.
30
+ - On an Apple M4 Pro the command stream is committed every 16 dispatches (`backend/devices/apple/apple_m4_pro.yml`):
31
+ the GPU starts a step while the host is still encoding it.
32
+
33
+ ### Fixed
34
+ - `served_certification` answers what a launch is served: a key certified under its generator's alias (the one hop
35
+ a launch's lookup takes) is found by a planner too, so a plan no longer counts a served key as missing.
36
+ - A peer question the GPU runtime fails is refused by name (`DeviceAllocator.can_access_peer`), never read as "no
37
+ peer"; the expandable memory range asks that one door which cards may reach its memory.
38
+ - `install_shadow(devices)` installs on a host whose GPU runtime is there without its driver (it sees no device);
39
+ a driver that loads and refuses still raises its `DeviceQueryError`.
40
+
10
41
  ## [0.1.7] - 2026-11-13
11
42
 
12
43
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: nbxtensor
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Run AI models without PyTorch: tensors, Triton kernels, planned memory and certified tuning, wherever Triton runs — NVIDIA, AMD, Intel and Apple GPUs.
5
5
  Project-URL: Homepage, https://github.com/NeuroBrix/nbxtensor
6
6
  Project-URL: Source, https://github.com/NeuroBrix/nbxtensor
@@ -138,10 +138,13 @@ def pool_fit_slack(vendor, architecture) -> float # pool.fit_slack
138
138
  # the allocator's figures and the pool's controls, same arguments as `DeviceAllocator`'s (2026-11-13):
139
139
  def memory_allocated(device_idx=None) -> int # live bytes handed out (None: every device)
140
140
  def pool_cached_bytes(device_idx=None) -> int # bytes parked in the pool's free blocks
141
+ def pool_stats() -> dict # a copy of the pool's counters (hits, miss, flushes, evictions)
141
142
  def blocks_in_use(device_idx=None) -> dict # {address: bytes} of the blocks tensors hold
142
143
  def device_free_bytes(device_idx=None) -> int # the driver's free bytes (None: current device)
143
144
  def device_total_bytes(device_idx=None) -> int # the device's total memory (refused: DeviceQueryError)
144
145
  def free_memory_mb(index: int) -> float # the driver's free memory in MB (refused: DeviceQueryError)
146
+ def peak_memory_allocated(device_idx=None) -> int # highest live bytes on a device since its last reset (None: summed)
147
+ def reset_peak_memory(device_idx=None) -> None # restart that peak from the live bytes (None: every device)
145
148
  def peak_device_bytes() -> Optional[int] # the most one device held at once since the start
146
149
  def host_pinned_allocated() -> int # live pinned host bytes
147
150
  def empty_cache_pool() -> int # the pool's parked blocks given back; bytes freed
@@ -2913,6 +2916,34 @@ def copies(nbytes=1 << 30, reps=10) -> dict
2913
2916
 
2914
2917
  The operands come from `numpy.random.default_rng(0)`: two machines time the same values.
2915
2918
 
2919
+ ### `nbxtensor.profile` — where a real run's GPU time goes, kernel by kernel
2920
+
2921
+ ```python
2922
+ def ranked_call(fn, path=None, out=print) # fn() inside a session, its table to `out` (and `path` as JSON)
2923
+ def kernel_times() -> ContextManager[KernelTimes]
2924
+ # a profiling session around the caller's work (Metal; another backend refused by name; one per process): every
2925
+ # launch and every copy runs alone and is timed on the GPU at its own boundaries — the table RANKS kernels, it is
2926
+ # not the production step's time (the batching changes)
2927
+ class KernelTimes
2928
+ # rows: {kernel name: [launches, total ms, max ms]} ('blit' for the copies); wall_s, gpu_ms, unsampled;
2929
+ # ranked() -> [(name, launches, total ms, max ms)] heaviest first; format(top=25) -> the printed table; as_dict();
2930
+ # report(path=None, top=25) -> the table, and the whole of it written to `path` as JSON
2931
+ ```
2932
+
2933
+ `nbxtensor.backend.metal_profile` — the Metal mechanism behind it
2934
+
2935
+ ```python
2936
+ SESSION # the open session or None: the one flag the stream reads
2937
+ POOL_ASK # the sample buffers a first session asks the device for (it keeps what is granted)
2938
+ class Session(device, per_buffer)
2939
+ # open_encoder(command_buffer, kind, index, label): a launch's own encoder, sampled at 2 x index and 2 x index + 1;
2940
+ # retired(command_buffer): its samples read into the table; close() -> KernelTimes; granted_pool()
2941
+ def open_session(device, per_buffer, flush) -> KernelTimes
2942
+ def close_session(flush) -> KernelTimes
2943
+ ```
2944
+
2945
+ `MetalRuntime.open_kernel_times()`, `close_kernel_times()`; `encoder_for(stream, kind, label=None)` names the launch.
2946
+
2916
2947
  ### `nbxtensor.io.read_rate` — how fast the machine reads its weight files, by parallel reads
2917
2948
 
2918
2949
  ```python
@@ -3120,9 +3151,25 @@ def synchronize() -> None # the current device finished, through
3120
3151
  def drain(index: Optional[int] = None) -> None # every stream of a device drained; the current device restored
3121
3152
  def mem_info(index: Optional[int] = None) -> Tuple[int, int] # (free, total) bytes, as the runtime reports them
3122
3153
  def most_free() -> int # the device with the most free memory; the current device restored
3154
+ def target_name() -> str # what the process compiles for, `<backend>-<arch>` (cuda-70); a driver's refusal raised
3123
3155
  class DeviceQueryError(RuntimeError) # a device question the runtime refused: the call, the device, its code
3124
3156
  NoGpuRuntime # (backend.runtime) no GPU runtime on this host: the one refusal meaning no device
3125
- ```
3157
+ def install_shadow(devices: int) -> None # the process becomes a shadow of `devices` devices, once (memory.shadow)
3158
+ DevicesVisible # (memory.shadow) install_shadow refused: a device is in sight
3159
+ def declare_target(maker: str, capability: str) -> None # the compile target bound with no driver asked
3160
+ class TargetNotDeclarable(ValueError) # declare_target refused: a maker other than nvidia / amd, or no capability number
3161
+ ```
3162
+
3163
+ **A device with no driver asked (2026-11-13).** Two doors serve an application that derives what a run would launch
3164
+ without running it. `install_shadow(devices)` turns the process into a shadow: allocations hand out addresses that
3165
+ address nothing, no kernel launches, a value read answers a benign value (a value born on the host answers its own).
3166
+ After it, `count()` answers `devices` and `current()` answers the device `select` named last. It is refused with
3167
+ `DevicesVisible` while the runtime sees a device, and with `ValueError` for a count below one.
3168
+ `declare_target(maker, capability)` binds the compile target a hardware description states, so that
3169
+ `backend.launcher.target()` and the device description answer as on that device: `"nvidia"` is cuda with 32
3170
+ threads a warp, `"amd"` is hip with 64, and `"7.0"` becomes 70. It is refused with `TargetNotDeclarable` for any other
3171
+ maker, since a device whose architecture is a name keeps its driver's answer, and for a capability that is not
3172
+ "major" or "major.minor".
3126
3173
 
3127
3174
  No device is a fact, a refusal is an error: `count()` is 0 only on a host with no GPU runtime
3128
3175
  (`nbxtensor.backend.runtime.NoGpuRuntime`) or when the runtime answers its own "no device" code (the backend table's
@@ -3563,6 +3610,7 @@ def reset_runtime_for_tests() -> None # Drop the cached runtime — and everyt
3563
3610
  class CapturedPlan # One bucket's action list as an instantiated CUDA graph.
3564
3611
  class GraphReplayError #
3565
3612
  class SegmentedPlan # A multi-card plan's action list as one CUDA graph per stretch of actions on one card (S3, 2026-10-28).
3613
+ def capable() -> bool # The backend offers CUDA graphs (the driver's cuGraph API this module binds): CUDA today. HIP, Metal and Level
3566
3614
  ```
3567
3615
 
3568
3616
  ### `nbxtensor.backend.runtime`
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "nbxtensor"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "Run AI models without PyTorch: tensors, Triton kernels, planned memory and certified tuning, wherever Triton runs — NVIDIA, AMD, Intel and Apple GPUs."
9
9
  readme = "README.md"
10
10
  license = { text = "Apache-2.0" }
@@ -13,5 +13,5 @@ first publication is 0.0.1, each fix after it increments, the Rust rewrite is
13
13
  """
14
14
 
15
15
  #: the one version number; `pyproject.toml` states the same (tests/test_version.py)
16
- __version__ = "0.1.7"
16
+ __version__ = "0.1.8"
17
17
  __all__: list = []
@@ -156,10 +156,14 @@ dispatch:
156
156
  # NeuroBrix stream is one command buffer with one serialised compute
157
157
  # encoder; this bounds how long the host waits for a result and how much
158
158
  # work a single failure takes down with it. It is not a correctness knob —
159
- # the encoder's own barriers keep the order at any value. A decode step of
160
- # TinyLlama encodes ~1,350 dispatches, so 512 puts it in three buffers
161
- # where one per launch put it in 1,505.
162
- max_dispatches_per_command_buffer: 512
159
+ # the encoder's own barriers keep the order at any value. It also sets how
160
+ # soon the GPU starts on a step the host is still encoding: the GPU runs
161
+ # nothing of a buffer before its commit. MEASURED on THIS chip 2026-11-13
162
+ # (TinyLlama, 128 tokens, warm; a decode step ~660 dispatches): 512 3.90 s,
163
+ # 128 3.68, 64 3.61, 32 3.56, 16 3.51, 8 3.48, 4 3.51, 2 3.56 — the same
164
+ # output bytes at every value. 16: within noise of the best, half the
165
+ # buffers of 8.
166
+ max_dispatches_per_command_buffer: 16
163
167
 
164
168
  autotune:
165
169
  buckets:
@@ -359,9 +359,9 @@ class FrozenPlan:
359
359
  self.extra_scan: Tuple[int, ...] = tuple(s for s in extra_scan if s >= self.scan_limit)
360
360
  # the slabs of the OTHER cards the plan allocated on (held experts' cards): pinned for the plan's life
361
361
  self.other_slabs: Dict[int, "SlabAllocator"] = {}
362
- # Phase 4b: lazily captured CUDA graph of the action list
363
- # (opt-in NBX_REPLAY_GRAPH=1, A/B-gated adoption). A capture
364
- # failure disables the graph for this bucket only — direct
362
+ # Phase 4b: lazily captured CUDA graph of the action list, wherever the backend offers CUDA graphs
363
+ # (`replay_graph.capable`). Adopted 2026-11-14 on its measured A/B (V100, served decode, bytes identical):
364
+ # the direct replay issues ~725 launches and ~190 copies a token from the host. A capture failure disables the graph for this bucket only: the direct
365
365
  # replay stays the correct path.
366
366
  self.graph = None
367
367
  self.graph_disabled = False
@@ -384,8 +384,8 @@ class FrozenPlan:
384
384
  # (`replay_graph.SegmentedPlan`), the engine's choice: its direct replay is ~1 850 Python-driven launches a
385
385
  # token (Qwen3-30B-A3B on 4 V100, 2026-10-28: ~60 ms of a 184 ms token for a few ms of kernels).
386
386
  _segmented = self.crosses_cards() or self.scan_slots is not None # a segment of a step: graphs too
387
- if ((os.environ.get("NBX_REPLAY_GRAPH") == "1" or _segmented)
388
- and not self.graph_disabled):
387
+ from nbxtensor.backend.replay_graph import capable as _graph_capable
388
+ if _graph_capable() and not self.graph_disabled:
389
389
  self._replay_graph(_segmented)
390
390
  else:
391
391
  self._direct_actions()
@@ -61,6 +61,7 @@ import threading
61
61
  from typing import Dict, Optional, Tuple
62
62
  import nbxtensor.memory.allocator as _nbx_allocator # the module the moved names live in (M2 cut of tensor.py)
63
63
  import nbxtensor.backend.runtime as _nbx_runtime # the module the moved names live in (M2 cut of tensor.py)
64
+ from nbxtensor.backend import metal_profile as _profile
64
65
 
65
66
  # Status codes. 0 is success, mirroring the C runtimes the seam was written
66
67
  # against; the non-zero values are ours and appear only in NeuroBrix errors.
@@ -665,6 +666,8 @@ class MetalRuntime:
665
666
  error = command_buffer.error()
666
667
  if error is not None:
667
668
  raise RuntimeError(f"Metal command buffer failed: {error}")
669
+ if _profile.SESSION is not None:
670
+ _profile.SESSION.retired(command_buffer) # its launches' samples, read once it has retired
668
671
 
669
672
  def _dispatches_per_buffer(self) -> int:
670
673
  """How many dispatches one command buffer may carry before it is
@@ -679,9 +682,13 @@ class MetalRuntime:
679
682
  """The open encoder of this stream, opening one if there is none.
680
683
 
681
684
  Returns `(command_buffer, encoder)`. The caller encodes and then calls
682
- `note_dispatch`; it must not commit — the stream owns that.
685
+ `note_dispatch`; it must not commit — the stream owns that. Inside a
686
+ kernel-time session (`metal_profile`) every launch gets its own timed
687
+ encoder (a launch names it after: `metal_profile.Session.name`).
683
688
  """
684
689
  key = int(stream or 0)
690
+ if _profile.SESSION is not None:
691
+ return self._timed_encoder(key, kind)
685
692
  with self._lock:
686
693
  entry = self._open.get(key)
687
694
  if entry is not None and entry[2] != kind:
@@ -706,6 +713,29 @@ class MetalRuntime:
706
713
  self._open[key] = [command_buffer, encoder, kind, 0]
707
714
  return command_buffer, encoder
708
715
 
716
+ def _timed_encoder(self, key: int, kind: str):
717
+ """A kernel-time session's encoder: the stream's previous one ended, a new one opened that samples its own
718
+ start and end at the launch's index in the buffer (`metal_profile.Session.open_encoder`)."""
719
+ with self._lock:
720
+ entry = self._open.get(key)
721
+ if entry is None:
722
+ queue = self._resolve_queue(key)
723
+ if queue is None:
724
+ return None, None
725
+ entry = self._open[key] = [queue.commandBuffer(), None, kind, 0]
726
+ if entry[1] is not None:
727
+ entry[1].endEncoding()
728
+ entry[1] = _profile.SESSION.open_encoder(entry[0], kind, entry[3])
729
+ entry[2] = kind
730
+ return entry[0], entry[1]
731
+
732
+ def open_kernel_times(self):
733
+ """Open the process's kernel-time session (`nbxtensor.profile.kernel_times`)."""
734
+ return _profile.open_session(self._device, self._dispatches_per_buffer(), self.flush)
735
+
736
+ def close_kernel_times(self):
737
+ return _profile.close_session(self.flush)
738
+
709
739
  @staticmethod
710
740
  def _new_encoder(command_buffer, kind: str):
711
741
  if kind == "blit":
@@ -19,6 +19,7 @@ threadgroups. An argument this runtime cannot bind fails by name; there is no ot
19
19
  """
20
20
  from __future__ import annotations
21
21
 
22
+ from nbxtensor.backend import metal_profile as _profile
22
23
  import hashlib
23
24
  import os
24
25
  import tempfile
@@ -195,6 +196,8 @@ def dispatch(pipe: Pipeline, stream: int, pointers: Sequence[int], scalars: Opti
195
196
  _cb, encoder = rt.encoder_for(stream, kind="compute")
196
197
  if encoder is None: # pragma: no cover
197
198
  raise RuntimeError(f"no Metal compute encoder for stream {stream} to launch {pipe.name!r}")
199
+ if _profile.SESSION is not None:
200
+ _profile.SESSION.name(_cb, pipe.name) # the launch's row in the kernel-time table
198
201
  encoder.setComputePipelineState_(pipe.pso)
199
202
  if shared:
200
203
  encoder.setThreadgroupMemoryLength_atIndex_(int(shared), 0)
@@ -0,0 +1,167 @@
1
+ """Per-kernel GPU time on Metal: a profiling session puts every launch in its OWN encoder and times it at the encoder's
2
+ boundaries (the public door: `nbxtensor.profile.kernel_times`).
3
+
4
+ What the hardware gives (asked of an M4 Pro, 2026-11-13): counter sampling at STAGE boundaries only, never at a
5
+ dispatch inside an encoder, and the one counter set `timestamp`. The stream (`metal_device`) normally carries many
6
+ launches in one serial encoder, so a session changes the batching: its figures RANK kernels; they are not the
7
+ production step's time. The ticks are converted with the device's own CPU/GPU timestamp pairs, sampled when the
8
+ session opens and closes.
9
+
10
+ A command buffer gets one sample buffer of 2 x `dispatches_per_buffer` samples (a launch's start and end at 2i,
11
+ 2i + 1, i its index in the buffer); its samples are read when the buffer has retired (`metal_device._await`, or the
12
+ session's close). The device keeps few sample buffers alive at once (an M4 Pro: 32, measured 2026-11-13), so the
13
+ first session takes the ones the device grants, as the process's pool (every later session reuses it: the device
14
+ does not give them back when a session ends); when every one is held by a buffer not yet
15
+ retired, the session waits for its oldest timed buffer and reuses its samples — a wait of the profiling mode only.
16
+ """
17
+ from __future__ import annotations
18
+
19
+ import struct
20
+ import time
21
+ from typing import Dict, List, Optional, Tuple
22
+
23
+ from nbxtensor.profile import KernelTimes
24
+
25
+ #: the open session, or None: the one flag the stream reads (`metal_device.encoder_for`, `_await`)
26
+ SESSION: Optional["Session"] = None
27
+
28
+ #: how many sample buffers a session asks the device for (it keeps what it is granted: an M4 Pro grants 32)
29
+ POOL_ASK = 64
30
+
31
+ #: a sample Metal could not take reads as this value (MTLCounterErrorValue)
32
+ _ERROR_VALUE = 0xFFFFFFFFFFFFFFFF
33
+
34
+
35
+ class Session:
36
+ def __init__(self, device, per_buffer: int) -> None:
37
+ import Metal
38
+ if not device.supportsCounterSampling_(Metal.MTLCounterSamplingPointAtStageBoundary):
39
+ raise RuntimeError(f"ZERO FALLBACK: {device.name()} samples no counter at an encoder's boundary: no "
40
+ f"per-kernel GPU time on this device")
41
+ sets = [cs for cs in (device.counterSets() or []) if cs.name() == Metal.MTLCommonCounterSetTimestamp]
42
+ if not sets:
43
+ raise RuntimeError(f"ZERO FALLBACK: {device.name()} has no timestamp counter set")
44
+ self.device, self.counters, self.per_buffer = device, sets[0], int(per_buffer)
45
+ self.table = KernelTimes()
46
+ self.free = list(_pool(self))
47
+ self.inflight: Dict[int, Tuple[object, object, List[Optional[str]]]] = {} # id(buffer) -> (buffer, samples, names)
48
+ self.t0 = time.perf_counter()
49
+ self.cpu0, self.gpu0 = device.sampleTimestamps_gpuTimestamp_(None, None)
50
+
51
+ def granted_pool(self) -> list:
52
+ """The sample buffers of 2 x dispatches_per_buffer samples the device grants now, up to POOL_ASK; refused by
53
+ name when it grants none."""
54
+ import Metal
55
+ pool, err = [], None
56
+ while len(pool) < POOL_ASK:
57
+ desc = Metal.MTLCounterSampleBufferDescriptor.alloc().init()
58
+ desc.setCounterSet_(self.counters)
59
+ desc.setStorageMode_(Metal.MTLStorageModeShared)
60
+ desc.setSampleCount_(2 * self.per_buffer)
61
+ samples, err = self.device.newCounterSampleBufferWithDescriptor_error_(desc, None)
62
+ if samples is None:
63
+ break
64
+ pool.append(samples)
65
+ if not pool:
66
+ raise RuntimeError(f"ZERO FALLBACK: a timestamp sample buffer of {2 * self.per_buffer} samples "
67
+ f"(2 x dispatch.max_dispatches_per_command_buffer) was refused by the device: {err}")
68
+ return pool
69
+
70
+ def _samples_for(self, command_buffer):
71
+ held = self.inflight.get(id(command_buffer))
72
+ if held is None:
73
+ if not self.free: # every sample buffer held: the oldest timed buffer first
74
+ oldest = next(iter(self.inflight.values()))[0]
75
+ oldest.waitUntilCompleted()
76
+ self.retired(oldest)
77
+ held = self.inflight[id(command_buffer)] = (command_buffer, self.free.pop(), [])
78
+ return held
79
+
80
+ def open_encoder(self, command_buffer, kind: str, index: int):
81
+ """The launch's own encoder, its start and end sampled at 2 x index and 2 x index + 1; its row is its kind until
82
+ the launch names it (`name`)."""
83
+ import Metal
84
+ _cb, samples, names = self._samples_for(command_buffer)
85
+ names.extend([None] * (index + 1 - len(names)))
86
+ names[index] = kind
87
+ desc = (Metal.MTLBlitPassDescriptor.blitPassDescriptor() if kind == "blit"
88
+ else Metal.MTLComputePassDescriptor.computePassDescriptor())
89
+ att = desc.sampleBufferAttachments().objectAtIndexedSubscript_(0)
90
+ att.setSampleBuffer_(samples)
91
+ att.setStartOfEncoderSampleIndex_(2 * index)
92
+ att.setEndOfEncoderSampleIndex_(2 * index + 1)
93
+ if kind == "blit":
94
+ return command_buffer.blitCommandEncoderWithDescriptor_(desc)
95
+ return command_buffer.computeCommandEncoderWithDescriptor_(desc)
96
+
97
+ def name(self, command_buffer, label: str) -> None:
98
+ """The launch just opened on `command_buffer` is `label` (its kernel's name)."""
99
+ held = self.inflight.get(id(command_buffer))
100
+ if held is not None and held[2]:
101
+ held[2][-1] = label
102
+
103
+ def retired(self, command_buffer) -> None:
104
+ """A buffer that has completed: its launches' samples read into the table."""
105
+ held = self.inflight.pop(id(command_buffer), None)
106
+ if held is None:
107
+ return
108
+ _cb, samples, names = held
109
+ self.free.append(samples)
110
+ n = len(names)
111
+ if n == 0:
112
+ return
113
+ raw = bytes(samples.resolveCounterRange_((0, 2 * n)))
114
+ ticks = struct.unpack(f"<{2 * n}Q", raw[:16 * n])
115
+ for i, name in enumerate(names):
116
+ a, b = ticks[2 * i], ticks[2 * i + 1]
117
+ if name is None:
118
+ continue
119
+ if a == _ERROR_VALUE or b == _ERROR_VALUE or b < a:
120
+ self.table.unsampled += 1
121
+ continue
122
+ self.table.add(name, float(b - a)) # ticks, scaled to ms at close
123
+
124
+ def close(self) -> KernelTimes:
125
+ for command_buffer, _s, _n in list(self.inflight.values()):
126
+ command_buffer.waitUntilCompleted()
127
+ self.retired(command_buffer)
128
+ cpu1, gpu1 = self.device.sampleTimestamps_gpuTimestamp_(None, None)
129
+ ns_per_tick = (cpu1 - self.cpu0) / (gpu1 - self.gpu0) if gpu1 != self.gpu0 else 1.0
130
+ for row in self.table.rows.values():
131
+ row[1] *= ns_per_tick / 1e6
132
+ row[2] *= ns_per_tick / 1e6
133
+ self.table.wall_s = time.perf_counter() - self.t0
134
+ return self.table
135
+
136
+
137
+ _POOL: Dict[int, list] = {} # samples per buffer -> the process's granted sample buffers
138
+
139
+
140
+ def _pool(session: "Session") -> list:
141
+ if session.per_buffer not in _POOL:
142
+ _POOL[session.per_buffer] = session.granted_pool()
143
+ return _POOL[session.per_buffer]
144
+
145
+
146
+ def open_session(device, per_buffer: int, flush) -> KernelTimes:
147
+ """Open the process's one session on `device`: `flush()` commits and waits for the work encoded before it, so
148
+ every launch inside is timed alone. Refused by name when one is open."""
149
+ global SESSION
150
+ if SESSION is not None:
151
+ raise RuntimeError("ZERO FALLBACK: a kernel-time session is already open in this process")
152
+ flush()
153
+ SESSION = Session(device, per_buffer)
154
+ return SESSION.table
155
+
156
+
157
+ def close_session(flush) -> KernelTimes:
158
+ """Every launch of the session retired and read; the flag cleared whatever happens."""
159
+ global SESSION
160
+ session = SESSION
161
+ if session is None:
162
+ raise RuntimeError("ZERO FALLBACK: no kernel-time session is open")
163
+ try:
164
+ flush()
165
+ return session.close()
166
+ finally:
167
+ SESSION = None
@@ -7,8 +7,9 @@ direct C-launcher replay (Phase 4a); every CUresult is checked and any
7
7
  failure refuses LOUDLY back to direct replay for that bucket
8
8
  (llama.cpp guard discipline — their CC<8 disable is a policy under a
9
9
  re-capture-per-token cost model, not a hardware gate; sourced research
10
- in optimization_engine_scoping.md §4b). Kill-switch: unset
11
- NBX_REPLAY_GRAPH (the graph path is opt-in).
10
+ in optimization_engine_scoping.md §4b). The default wherever the
11
+ backend offers CUDA graphs (`capable`), since 2026-11-14 (measured
12
+ A/B in frozen_plan); elsewhere the direct replay runs.
12
13
 
13
14
  Capture legality:
14
15
  - kernels are re-issued through the SAME compiled C launcher but on
@@ -57,6 +58,13 @@ class GraphReplayError(RuntimeError):
57
58
  pass
58
59
 
59
60
 
61
+ def capable() -> bool:
62
+ """The backend offers CUDA graphs (the driver's cuGraph API this module binds): CUDA today. HIP, Metal and Level
63
+ Zero replay directly."""
64
+ from nbxtensor.backend import runtime as _rt
65
+ return _rt.gpu_backend() == "cuda"
66
+
67
+
60
68
  def _ck(rc: int, what: str) -> None:
61
69
  if rc != _CUDA_SUCCESS:
62
70
  raise GraphReplayError(f"{what}: CUresult={rc}")
@@ -121,6 +129,14 @@ class CapturedPlan:
121
129
 
122
130
  def __init__(self, records: List[Tuple[str, tuple]],
123
131
  dev_idx) -> None:
132
+ # A plan on ONE card carries the SETDEV that names it (`frozen_plan.SETDEV`, emitted when the device changes,
133
+ # so a single-card plan has one): the graph is captured on that card and the record makes no node. Until
134
+ # 2026-11-14 it fell into the memset branch ("expected 3, got 1") and every single-card capture was refused
135
+ # to the direct replay. A device SYNC the recording made on that same card (`frozen_plan.SYNC`) makes no node
136
+ # either: one stream orders every node after the one before, no host work runs between them, and `launch`
137
+ # synchronises the context before and after the graph. A plan whose records name another card (a SETDEV or a
138
+ # SYNC: a peer copy waiting on its source card) is `SegmentedPlan`'s, refused here by name.
139
+ records, dev_idx = self._one_card(records, dev_idx)
124
140
  api = _CudaGraphAPI.get()
125
141
  self.api = api
126
142
  self.staging: List[int] = []
@@ -135,20 +151,7 @@ class CapturedPlan:
135
151
  self.stream = stream
136
152
  n_launch = 0
137
153
  capturing = False
138
- # Pre-pass OUTSIDE capture: stage every recorded H2D snapshot
139
- # into a dedicated device buffer (sync malloc/memcpy are not
140
- # capture-legal; the snapshots are plan constants, so one
141
- # upload serves every launch).
142
- staged = {}
143
- for i, (tag, rec) in enumerate(records):
144
- if tag == "h":
145
- dst, snap = rec
146
- stage = DeviceAllocator.malloc_cuda(len(snap), dev_idx)
147
- buf = (ctypes.c_char * len(snap)).from_buffer_copy(snap)
148
- DeviceAllocator.memcpy(stage, ctypes.addressof(buf),
149
- len(snap), 1)
150
- staged[i] = stage
151
- self.staging.append(int(stage))
154
+ staged = self._stage_snapshots(records, dev_idx)
152
155
  try:
153
156
  _ck(api.begin(stream, _CU_STREAM_CAPTURE_MODE_RELAXED),
154
157
  "cuStreamBeginCapture_v2")
@@ -176,7 +179,7 @@ class CapturedPlan:
176
179
  ctypes.c_void_p(dst),
177
180
  ctypes.c_void_p(staged[i]),
178
181
  len(snap), stream), "cuMemcpyDtoDAsync(h2d)")
179
- else: # "s"
182
+ else: # "s" (every other tag refused above)
180
183
  ptr, value, nbytes = rec
181
184
  _ck(api.memset_d8(
182
185
  ctypes.c_void_p(ptr), value & 0xFF, nbytes,
@@ -209,6 +212,39 @@ class CapturedPlan:
209
212
  raise
210
213
  self.launches = n_launch
211
214
 
215
+ @staticmethod
216
+ def _one_card(records, dev_idx):
217
+ """The plan's one card and its records without the SETDEV / SYNC that name it; a plan with another action or
218
+ a second card is refused by name (`SegmentedPlan`'s)."""
219
+ devs = {rec[0] for tag, rec in records if tag in ("d", "y")}
220
+ if dev_idx is not None:
221
+ devs.add(dev_idx)
222
+ foreign = sorted({tag for tag, _ in records} - {"k", "m", "h", "s", "d", "y"})
223
+ if foreign or len(devs) > 1:
224
+ raise GraphReplayError(f"one graph holds one card's kernels, copies and memsets: this plan has "
225
+ f"{'actions ' + str(foreign) if foreign else ''}"
226
+ f"{' and ' if foreign and len(devs) > 1 else ''}"
227
+ f"{'cards ' + str(sorted(devs)) if len(devs) > 1 else ''} (SegmentedPlan's)")
228
+ if devs:
229
+ dev_idx = next(iter(devs))
230
+ return [r for r in records if r[0] not in ("d", "y")], dev_idx
231
+
232
+ def _stage_snapshots(self, records, dev_idx):
233
+ """Pre-pass OUTSIDE capture: every recorded H2D snapshot staged into a dedicated device buffer (sync
234
+ malloc/memcpy are not capture-legal; the snapshots are plan constants, so one upload serves every launch).
235
+ Returns {record index: device buffer}; the buffers are kept in `self.staging` for `destroy`."""
236
+ staged = {}
237
+ for i, (tag, rec) in enumerate(records):
238
+ if tag == "h":
239
+ dst, snap = rec
240
+ stage = DeviceAllocator.malloc_cuda(len(snap), dev_idx)
241
+ buf = (ctypes.c_char * len(snap)).from_buffer_copy(snap)
242
+ DeviceAllocator.memcpy(stage, ctypes.addressof(buf),
243
+ len(snap), 1)
244
+ staged[i] = stage
245
+ self.staging.append(int(stage))
246
+ return staged
247
+
212
248
  def launch(self) -> None:
213
249
  # DEVICE-wide sync BEFORE the graph: the per-step input copies
214
250
  # (replay's slot scan) ride the LEGACY stream as async work,