Small refactoring and fixed possible deadlock with 4-5kb+ sources.
Small refactoring and fixed possible deadlock with 4-5kb+ sources.

ROCmSoftwarePlatform/MIOpen,ROCmSoftwarePlatform/MIOpen,ROCmSoftwarePlatform/MIOpen,ROCmSoftwarePlatform/MIOpen,ROCmSoftwarePlatform/MIOpen