Different CUDA versions bring different results

I have observed on SD WebUI (using PyTorch) that different cuda versions of PyTorch get different results, and such results are larger or smaller depending on the model and prompt used, and I’m wondering if this difference is expected? Is there a way to reduce this difference?

Detailed contents here: Ensure consistency of results across different PyTorch versions · AUTOMATIC1111/stable-diffusion-webui · Discussion #8257 (github.com)

Could you describe the effects you are observing?
Based on the cross-post it seems slightly different images are produced. Do you expect to get bitwise-identical results or is one output considered to be “wrong” for some reason?

According to my limited observation I found that the difference is mainly centered on the cuda version and has nothing to do with the pytorch version, I wonder why this difference exists, is it a bug? There is no error message during the running process.
Second, whether this difference can be controlled, depending on the actual use situation, this may be very large, which causes trouble for the reproducible results and reduces the effect of some models.
Finally, if evaluating these versions, I think 1.13.1+cu117 has the biggest problem, and many of the differences it produces will neither appear in 1.13.1+cu116 nor 2.0+cu118, but the latter is often closer.

You cannot expect to see bitwise-identical results when libraries are updated and small errors caused by the limited floating point precision are expected.
It’s still unclear how large the errors are and if these are unexpected or not.

Is there an easy way to build an older CUDA version of PyTorch for use under Win?

It depends what your definition of “easy” is, but you should be able to build PyTorch from source on Windows using these instructions. I’m not deeply familiar with the Windows build steps as I’m using Linux systems.