Comments (6)
Do you have a minimal code example that can reproduce?
Just profiling jax.block_until_ready(jax.numpy.zeros((9500000,3), dtype=jnp.float32))
in isolation takes <500us on my end on a V100.
from jax.
Oh, XLA JIT compilation should be used to reproduce. Thank you! I can repro a compute time latency of 131 microseconds with
@jax.jit
def run_zeros() -> jax.Array:
"""Run the main logic to benchmark."""
with jax.named_scope("benchmark_broadcast"):
return jnp.zeros((9500000, 3), dtype=jnp.float32)
values = run_zeros()
jax.block_until_ready(values)
print(values)
The resulting HLO indicates the slow broadcast:
@@f32[9500000,3]{1,0} fusion(), kind=kLoop, calls=
{
tmp_0 = f32[] constant(0)
ROOT tmp_1 = f32[9500000,3]{1,0} broadcast(f32[] tmp_0), dimensions={}
}
from jax.
Might it be possible that the CUDA implementation for broadcast here only uses 1 SM? And is thus not parallelized?
from jax.
Ah, it's 130 microseconds, not milliseconds?
I don't think it's physically possible to do better?
A V100 has 900GB/s memory bandwidth, per the specs. 9500000 * 3 * 4 bytes / 900e9 bytes/sec = 127us
.
(I'm a bit surprised here, actually, I thought NVIDIA's published bandwidth numbers are bidirectional, which would mean twice as long, but your measurement seems to indicate otherwise.)
So... unless I'm mistaken, you're almost getting roofline memory bandwidth and you should not expect to do better?
from jax.
Ohhh... Apologies. It is 131 microseconds! I have corrected the original post.
from jax.
Thank you for the analysis! I suppose allocating a new memory block (versus reading from existing memory) also encounters this memory bandwidth. That would present a bottleneck indeed that means we can't do better.
from jax.
Related Issues (20)
- JAX JIT Compilation Issue with jnp.std and Configuration Setting HOT 2
- FP8 XLA matmul fusion into `__cublas$lt$matmul$f8` not fully working HOT 2
- guidance on how to properly use lax.reduce on an multi-dimension array. HOT 1
- Partial of a vmap function HOT 2
- Support dlpack pinned host memory device type (kDLCPUPinned / kDLCUDAHost)
- Issue with shardmap when trying to use static arguments HOT 6
- TPUVM program hangs when using jax_compilation_cache_dir with wrong gcs directory HOT 8
- Getting different results from CPU vs. CUDA backend HOT 3
- Accidentally exponential-time analysis pass in compiler? HOT 9
- Local shards accessed using devices_indices_map are scaled by # of pods HOT 2
- Incorrect Jacobian of `jax.scipy.special.logsumexp` when `b` contains a `0` HOT 1
- Accuracy of `jax.experimental.sparse.spsolve` HOT 3
- How can I implement a custom operations with stateful resource? HOT 6
- all inputs are nans in a next step iterationwhile using `jax.scipy.optimize.minimize` HOT 1
- INVALID_ARGUMENT: Mismatched PJRT plugin PJRT API version HOT 5
- [pallas] Documentation for tpu compiler options
- Deadlock When Running distributed.initialize() on one TPU Host by Accident HOT 1
- Pipelined model(1F1B pipeline parallelism) implementation in Jax.
- Wrong normalization in FFT methods HOT 4
- DCT normalization affects distribution of spectral coefficients
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jax.