Create texture with RHICreateTexture2D and set it in a Material

I’m using compute shaders, and the result is written in a FRHITexture2D, created using RHICreateTexture2D. I want to apply the texture to a material, and visualize the result in the scene.
How do I set it in a Material? I did not see a trivial way to set the FRHITexture2D into a UTexture. Setting UTexture::TextureReference crashed the editor.
I could use UTexture2D::CreateTransient but I need TexCreate_ShaderResource and TexCreate_UAV flags enabled.
Any thoughts?