[SE] Allow context reuse in CreatedContexts::Add.
[SE] Allow context reuse in CreatedContexts::Add.

It's possible for an already-existing context to be returned by
cuDevicePrimaryCtxRetain.  Previously, this would be handled incorrectly
by CreatedContexts::Add, which was assuming that inserts into the map
always succeeded.

This makes XLA work with
TF_CUDA_PLATFORM_GPU_DEVICE_SCHEDULE=blocking_sync, although exactly how
that flag is related to this bug is unclear to me.  It seems like some
sort of race condition, maybe?
PiperOrigin-RevId: 207010059

tensorflow/tensorflow,manipopopo/tensorflow,ppwwyyxx/tensorflow,hehongliang/tensorflow,petewarden/tensorflow,paolodedios/tensorflow,kevin-coder/tensorflow-fork,xzturn/tensorflow,theflofly/tensorflow,davidzchen/tensorflow,ageron/tensorflow,DavidNorman/tensorflow,dongjoon-hyun/tensorflow,davidzchen/tensorflow,theflofly/tensorflow,sarvex/tensorflow,Bismarrck/tensorflow,jhseu/tensorflow,freedomtan/tensorflow,paolodedios/tensorflow,seanli9jan/tensorflow,AnishShah/tensorflow,jbedorf/tensorflow,ppwwyyxx/tensorflow,xodus7/tensorflow,jendap/tensorflow,tensorflow/tensorflow-pywrap_saved_model,xodus7/tensorflow,dongjoon-hyun/tensorflow,girving/tensorflow,Intel-tensorflow/tensorflow,alshedivat/tensorflow,adit-chandra/tensorflow,ghchinoy/tensorflow,ageron/tensorflow,alsrgv/tensorflow,ghchinoy/tensorflow,hfp/tensorflow-xsmm,alsrgv/tensorflow,theflofly/tensorflow,annarev/tensorflow,dancingdan/tensorflow,annarev/tensorflow,aam-at/tensorflow,aselle/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,arborh/tensorflow,Intel-tensorflow/tensorflow,ghchinoy/tensorflow,seanli9jan/tensorflow,dancingdan/tensorflow,ageron/tensorflow,arborh/tensorflow,sarvex/tensorflow,paolodedios/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,manipopopo/tensorflow,Bismarrck/tensorflow,ghchinoy/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,xzturn/tensorflow,sarvex/tensorflow,asimshankar/tensorflow,AnishShah/tensorflow,seanli9jan/tensorflow,sarvex/tensorflow,girving/tensorflow,apark263/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,aselle/tensorflow,aam-at/tensorflow,aldian/tensorflow,yongtang/tensorflow,jendap/tensorflow,jhseu/tensorflow,girving/tensorflow,adit-chandra/tensorflow,renyi533/tensorflow,xzturn/tensorflow,dongjoon-hyun/tensorflow,hfp/tensorflow-xsmm,dancingdan/tensorflow,aldian/tensorflow,jendap/tensorflow,brchiu/tensorflow,aldian/tensorflow,hfp/tensorflow-xsmm,AnishShah/tensorflow,manipopopo/tensorflow,gunan/tensorflow,aldian/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,ghchinoy/tensorflow,girving/tensorflow,davidzchen/tensorflow,hehongliang/tensorflow,asimshankar/tensorflow,frreiss/tensorflow-fred,seanli9jan/tensorflow,alshedivat/tensorflow,renyi533/tensorflow,asimshankar/tensorflow,xodus7/tensorflow,frreiss/tensorflow-fred,alsrgv/tensorflow,jendap/tensorflow,manipopopo/tensorflow,jhseu/tensorflow,alshedivat/tensorflow,snnn/tensorflow,jbedorf/tensorflow,hehongliang/tensorflow,theflofly/tensorflow,ppwwyyxx/tensorflow,aam-at/tensorflow,alsrgv/tensorflow,ageron/tensorflow,chemelnucfin/tensorflow,ZhangXinNan/tensorflow,girving/tensorflow,alsrgv/tensorflow,adit-chandra/tensorflow,kevin-coder/tensorflow-fork,ZhangXinNan/tensorflow,snnn/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,petewarden/tensorflow,jendap/tensorflow,AnishShah/tensorflow,Intel-Corporation/tensorflow,snnn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,apark263/tensorflow,brchiu/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,annarev/tensorflow,asimshankar/tensorflow,brchiu/tensorflow,freedomtan/tensorflow,xodus7/tensorflow,Intel-Corporation/tensorflow,snnn/tensorflow,ZhangXinNan/tensorflow,hfp/tensorflow-xsmm,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,kevin-coder/tensorflow-fork,ppwwyyxx/tensorflow,alsrgv/tensorflow,apark263/tensorflow,adit-chandra/tensorflow,ageron/tensorflow,jhseu/tensorflow,jhseu/tensorflow,brchiu/tensorflow,AnishShah/tensorflow,aselle/tensorflow,gautam1858/tensorflow,aam-at/tensorflow,davidzchen/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow,brchiu/tensorflow,jbedorf/tensorflow,asimshankar/tensorflow,girving/tensorflow,snnn/tensorflow,jbedorf/tensorflow,DavidNorman/tensorflow,adit-chandra/tensorflow,ageron/tensorflow,renyi533/tensorflow,brchiu/tensorflow,frreiss/tensorflow-fred,arborh/tensorflow,yongtang/tensorflow,karllessard/tensorflow,freedomtan/tensorflow,jhseu/tensorflow,jendap/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,Bismarrck/tensorflow,gunan/tensorflow,alshedivat/tensorflow,asimshankar/tensorflow,arborh/tensorflow,xzturn/tensorflow,manipopopo/tensorflow,ppwwyyxx/tensorflow,asimshankar/tensorflow,gautam1858/tensorflow,hehongliang/tensorflow,karllessard/tensorflow,xodus7/tensorflow,dancingdan/tensorflow,yongtang/tensorflow,annarev/tensorflow,freedomtan/tensorflow,seanli9jan/tensorflow,ghchinoy/tensorflow,manipopopo/tensorflow,gunan/tensorflow,aselle/tensorflow,gautam1858/tensorflow,asimshankar/tensorflow,ppwwyyxx/tensorflow,gunan/tensorflow,ZhangXinNan/tensorflow,kevin-coder/tensorflow-fork,arborh/tensorflow,aam-at/tensorflow,chemelnucfin/tensorflow,chemelnucfin/tensorflow,karllessard/tensorflow,aam-at/tensorflow,dongjoon-hyun/tensorflow,DavidNorman/tensorflow,yongtang/tensorflow,girving/tensorflow,arborh/tensorflow,xodus7/tensorflow,karllessard/tensorflow,aselle/tensorflow,ghchinoy/tensorflow,sarvex/tensorflow,ghchinoy/tensorflow,jhseu/tensorflow,brchiu/tensorflow,frreiss/tensorflow-fred,kobejean/tensorflow,hehongliang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,dongjoon-hyun/tensorflow,manipopopo/tensorflow,apark263/tensorflow,renyi533/tensorflow,apark263/tensorflow,aam-at/tensorflow,kobejean/tensorflow,jhseu/tensorflow,adit-chandra/tensorflow,aam-at/tensorflow,petewarden/tensorflow,annarev/tensorflow,aselle/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,snnn/tensorflow,alshedivat/tensorflow,freedomtan/tensorflow,gunan/tensorflow,Bismarrck/tensorflow,gunan/tensorflow,dancingdan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,aselle/tensorflow,gautam1858/tensorflow,Bismarrck/tensorflow,freedomtan/tensorflow,chemelnucfin/tensorflow,DavidNorman/tensorflow,kobejean/tensorflow,gunan/tensorflow,AnishShah/tensorflow,sarvex/tensorflow,tensorflow/tensorflow,arborh/tensorflow,asimshankar/tensorflow,girving/tensorflow,theflofly/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,hehongliang/tensorflow,annarev/tensorflow,theflofly/tensorflow,ghchinoy/tensorflow,girving/tensorflow,aselle/tensorflow,brchiu/tensorflow,snnn/tensorflow,Intel-Corporation/tensorflow,DavidNorman/tensorflow,kobejean/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,AnishShah/tensorflow,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow,petewarden/tensorflow,manipopopo/tensorflow,tensorflow/tensorflow-pywrap_saved_model,renyi533/tensorflow,seanli9jan/tensorflow,AnishShah/tensorflow,tensorflow/tensorflow,seanli9jan/tensorflow,dancingdan/tensorflow,paolodedios/tensorflow,gautam1858/tensorflow,chemelnucfin/tensorflow,arborh/tensorflow,hfp/tensorflow-xsmm,xodus7/tensorflow,kevin-coder/tensorflow-fork,gunan/tensorflow,theflofly/tensorflow,brchiu/tensorflow,xzturn/tensorflow,ghchinoy/tensorflow,Bismarrck/tensorflow,paolodedios/tensorflow,seanli9jan/tensorflow,DavidNorman/tensorflow,karllessard/tensorflow,paolodedios/tensorflow,jendap/tensorflow,xodus7/tensorflow,aldian/tensorflow,ZhangXinNan/tensorflow,dancingdan/tensorflow,theflofly/tensorflow,seanli9jan/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jbedorf/tensorflow,paolodedios/tensorflow,dongjoon-hyun/tensorflow,snnn/tensorflow,Bismarrck/tensorflow,alsrgv/tensorflow,karllessard/tensorflow,dancingdan/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_saved_model,xodus7/tensorflow,chemelnucfin/tensorflow,petewarden/tensorflow,DavidNorman/tensorflow,xzturn/tensorflow,Intel-tensorflow/tensorflow,Intel-Corporation/tensorflow,chemelnucfin/tensorflow,karllessard/tensorflow,dancingdan/tensorflow,xzturn/tensorflow,brchiu/tensorflow,theflofly/tensorflow,girving/tensorflow,tensorflow/tensorflow-pywrap_saved_model,alshedivat/tensorflow,chemelnucfin/tensorflow,arborh/tensorflow,ageron/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,xzturn/tensorflow,annarev/tensorflow,aam-at/tensorflow,ZhangXinNan/tensorflow,annarev/tensorflow,yongtang/tensorflow,jendap/tensorflow,dongjoon-hyun/tensorflow,aldian/tensorflow,apark263/tensorflow,alshedivat/tensorflow,Intel-Corporation/tensorflow,ppwwyyxx/tensorflow,Intel-Corporation/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,alshedivat/tensorflow,jendap/tensorflow,arborh/tensorflow,ppwwyyxx/tensorflow,davidzchen/tensorflow,Intel-tensorflow/tensorflow,hfp/tensorflow-xsmm,apark263/tensorflow,alsrgv/tensorflow,dongjoon-hyun/tensorflow,cxxgtxy/tensorflow,petewarden/tensorflow,kevin-coder/tensorflow-fork,Intel-tensorflow/tensorflow,ZhangXinNan/tensorflow,aam-at/tensorflow,renyi533/tensorflow,ppwwyyxx/tensorflow,DavidNorman/tensorflow,ageron/tensorflow,annarev/tensorflow,DavidNorman/tensorflow,Bismarrck/tensorflow,xzturn/tensorflow,adit-chandra/tensorflow,freedomtan/tensorflow,ZhangXinNan/tensorflow,frreiss/tensorflow-fred,yongtang/tensorflow,chemelnucfin/tensorflow,jendap/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,kobejean/tensorflow,kevin-coder/tensorflow-fork,Bismarrck/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,apark263/tensorflow,DavidNorman/tensorflow,petewarden/tensorflow,kobejean/tensorflow,cxxgtxy/tensorflow,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_saved_model,alsrgv/tensorflow,Intel-tensorflow/tensorflow,ageron/tensorflow,DavidNorman/tensorflow,renyi533/tensorflow,renyi533/tensorflow,ageron/tensorflow,hfp/tensorflow-xsmm,hfp/tensorflow-xsmm,hfp/tensorflow-xsmm,apark263/tensorflow,chemelnucfin/tensorflow,jendap/tensorflow,theflofly/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jbedorf/tensorflow,Intel-tensorflow/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,dongjoon-hyun/tensorflow,alshedivat/tensorflow,aselle/tensorflow,aselle/tensorflow,dancingdan/tensorflow,arborh/tensorflow,renyi533/tensorflow,frreiss/tensorflow-fred,yongtang/tensorflow,paolodedios/tensorflow,Bismarrck/tensorflow,paolodedios/tensorflow,AnishShah/tensorflow,aldian/tensorflow,dancingdan/tensorflow,petewarden/tensorflow,alshedivat/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_saved_model,theflofly/tensorflow,chemelnucfin/tensorflow,jbedorf/tensorflow,ppwwyyxx/tensorflow,cxxgtxy/tensorflow,ZhangXinNan/tensorflow,ppwwyyxx/tensorflow,adit-chandra/tensorflow,sarvex/tensorflow,alsrgv/tensorflow,karllessard/tensorflow,manipopopo/tensorflow,jhseu/tensorflow,jbedorf/tensorflow,karllessard/tensorflow,karllessard/tensorflow,girving/tensorflow,freedomtan/tensorflow,ageron/tensorflow,dongjoon-hyun/tensorflow,gunan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,kobejean/tensorflow,yongtang/tensorflow,adit-chandra/tensorflow,ageron/tensorflow,xzturn/tensorflow,xodus7/tensorflow,annarev/tensorflow,ghchinoy/tensorflow,jhseu/tensorflow,aam-at/tensorflow,snnn/tensorflow,tensorflow/tensorflow-pywrap_saved_model,seanli9jan/tensorflow,gunan/tensorflow,alshedivat/tensorflow,petewarden/tensorflow,AnishShah/tensorflow,ZhangXinNan/tensorflow,gunan/tensorflow,sarvex/tensorflow,aselle/tensorflow,kobejean/tensorflow,snnn/tensorflow,xzturn/tensorflow,kobejean/tensorflow,gautam1858/tensorflow,jbedorf/tensorflow,aldian/tensorflow,DavidNorman/tensorflow,jhseu/tensorflow,jhseu/tensorflow,gunan/tensorflow,AnishShah/tensorflow,cxxgtxy/tensorflow,Bismarrck/tensorflow,kevin-coder/tensorflow-fork,petewarden/tensorflow,aam-at/tensorflow,annarev/tensorflow,asimshankar/tensorflow,kobejean/tensorflow,davidzchen/tensorflow,snnn/tensorflow,tensorflow/tensorflow,xodus7/tensorflow,brchiu/tensorflow,ZhangXinNan/tensorflow,apark263/tensorflow,adit-chandra/tensorflow,asimshankar/tensorflow,davidzchen/tensorflow,gautam1858/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,chemelnucfin/tensorflow,dongjoon-hyun/tensorflow,ppwwyyxx/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,manipopopo/tensorflow,gautam1858/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-pywrap_saved_model,jbedorf/tensorflow,davidzchen/tensorflow,kevin-coder/tensorflow-fork,petewarden/tensorflow,cxxgtxy/tensorflow,arborh/tensorflow,freedomtan/tensorflow,hfp/tensorflow-xsmm,hehongliang/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,adit-chandra/tensorflow,cxxgtxy/tensorflow,gautam1858/tensorflow,kevin-coder/tensorflow-fork,frreiss/tensorflow-fred,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,freedomtan/tensorflow,kevin-coder/tensorflow-fork,davidzchen/tensorflow,tensorflow/tensorflow,petewarden/tensorflow,jbedorf/tensorflow,apark263/tensorflow,seanli9jan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-Corporation/tensorflow,theflofly/tensorflow,jbedorf/tensorflow,hfp/tensorflow-xsmm,alsrgv/tensorflow,ghchinoy/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,kobejean/tensorflow,manipopopo/tensorflow