@@ -45,6 +45,8 @@ IPyRunner pyRunner
4545
4646 private const string CppBuildToolsUrl = "https://aka.ms/vs/17/release/vs_BuildTools.exe" ;
4747
48+ private const string HipSdkDownloadUrl = "https://cdn.lykos.ai/AMD-HIP-SDK.exe" ;
49+
4850 private string HomeDir => settingsManager . LibraryDir ;
4951
5052 private string VcRedistDownloadPath => Path . Combine ( HomeDir , "vcredist.x64.exe" ) ;
@@ -83,6 +85,11 @@ IPyRunner pyRunner
8385 "BuildTools"
8486 ) ;
8587
88+ private string HipSdkDownloadPath => Path . Combine ( AssetsDir , "AMD-HIP-SDK.exe" ) ;
89+
90+ private string HipInstalledPath =>
91+ Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . ProgramFiles ) , "AMD" , "ROCm" , "5.7" ) ;
92+
8693 public string GitBinPath => Path . Combine ( PortableGitInstallDir , "bin" ) ;
8794 public bool IsPythonInstalled => File . Exists ( PythonDllPath ) ;
8895
@@ -192,6 +199,11 @@ public async Task InstallPackageRequirements(
192199 {
193200 await InstallVcBuildToolsIfNecessary ( progress ) ;
194201 }
202+
203+ if ( prerequisites . Contains ( PackagePrerequisite . HipSdk ) )
204+ {
205+ await InstallHipSdkIfNecessary ( progress ) ;
206+ }
195207 }
196208
197209 public async Task InstallAllIfNecessary ( IProgress < ProgressReport > ? progress = null )
@@ -202,6 +214,7 @@ public async Task InstallAllIfNecessary(IProgress<ProgressReport>? progress = nu
202214 await InstallGitIfNecessary ( progress ) ;
203215 await InstallNodeIfNecessary ( progress ) ;
204216 await InstallVcBuildToolsIfNecessary ( progress ) ;
217+ await InstallHipSdkIfNecessary ( progress ) ;
205218 }
206219
207220 public async Task UnpackResourcesIfNecessary ( IProgress < ProgressReport > ? progress = null )
@@ -553,6 +566,39 @@ await downloadService.DownloadToFileAsync(
553566 await process . WaitForExitAsync ( ) ;
554567 }
555568
569+ [ SupportedOSPlatform ( "windows" ) ]
570+ public async Task InstallHipSdkIfNecessary ( IProgress < ProgressReport > ? progress = null )
571+ {
572+ if ( Directory . Exists ( HipInstalledPath ) )
573+ return ;
574+
575+ await downloadService . DownloadToFileAsync ( HipSdkDownloadUrl , HipSdkDownloadPath , progress : progress ) ;
576+ Logger . Info ( "Downloaded & installing HIP SDK" ) ;
577+
578+ progress ? . Report (
579+ new ProgressReport (
580+ progress : 0.5f ,
581+ isIndeterminate : true ,
582+ type : ProgressType . Generic ,
583+ message : "Installing HIP SDK, this may take a few minutes..."
584+ )
585+ ) ;
586+
587+ var info = new ProcessStartInfo
588+ {
589+ FileName = HipSdkDownloadPath ,
590+ Arguments = "-install -log hip_install.log" ,
591+ UseShellExecute = true ,
592+ CreateNoWindow = true ,
593+ Verb = "runas"
594+ } ;
595+
596+ if ( Process . Start ( info ) is { } process )
597+ {
598+ await process . WaitForExitAsync ( ) ;
599+ }
600+ }
601+
556602 public async Task < Process > RunDotnet (
557603 ProcessArgs args ,
558604 string ? workingDirectory = null ,
0 commit comments