Create jiterator cache dirs recursively (reland) (#74592)
Summary:
Reland of https://github.com/pytorch/pytorch/pull/74425 with internal compilation error fixed
The change expects the base directories (`HOME/TEMP`, `XDG_CACHE_HOME`, or the user-defined `PYTORCH_KERNEL_CACHE_PATH`) to exist to avoid potentially exploiting the recursive folder creation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74592
Reviewed By: mruberry
Differential Revision: D35066710
Pulled By: malfet
fbshipit-source-id: c26aff826b0a3d6ca99286b031711698a515fbbb
(cherry picked from commit 99479e5a4fdc7c77080dd806e9dfd96e25f1192d)