File size: 45,438 Bytes
95b889b 91b1e2c 95b889b 91b1e2c 95b889b 91b1e2c 95b889b 91b1e2c 95b889b 91b1e2c 95b889b 91b1e2c 95b889b 91b1e2c 95b889b 91b1e2c 95b889b 5fe643e 95b889b 5fe643e 95b889b 5fe643e 95b889b 5fe643e 95b889b 91b1e2c 95b889b 5fe643e 95b889b 5fe643e 95b889b 5fe643e 95b889b 5fe643e 91b1e2c 5fe643e 91b1e2c 5fe643e 91b1e2c 95b889b 91b1e2c 95b889b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ROCm Forge — AI Copilot for CUDA-to-AMD Migration. Reduces migration effort by 65% with safe, explainable transformations.">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚒️</text></svg>">
<title>ROCm Forge — AI Copilot for CUDA-to-AMD Migration</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Vue.js -->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<!-- Highlight.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/python.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/cpp.min.js"></script>
<!-- FontAwesome & Google Fonts -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
brand: '#ed1c24', // AMD Red
brandGlow: 'rgba(237, 28, 36, 0.5)',
bgBase: '#0a0a0f',
panelBg: 'rgba(20, 20, 25, 0.7)',
panelBorder: 'rgba(255, 255, 255, 0.08)'
},
fontFamily: {
mono: ['"JetBrains Mono"', 'monospace'],
sans: ['Inter', 'sans-serif']
},
boxShadow: {
'neon': '0 0 20px rgba(237, 28, 36, 0.4)',
'neon-blue': '0 0 20px rgba(59, 130, 246, 0.4)',
'glass': '0 8px 32px 0 rgba(0, 0, 0, 0.37)'
}
}
}
}
</script>
<style>
body {
background-color: #050508;
color: #e2e8f0;
font-family: 'Inter', sans-serif;
background-image:
radial-gradient(circle at 15% 50%, rgba(237, 28, 36, 0.12), transparent 25%),
radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.12), transparent 25%);
background-attachment: fixed;
min-height: 100vh;
}
::selection { background: #ed1c24; color: white; }
.code-textarea { font-family: 'JetBrains Mono', monospace; font-size: 14px; line-height: 1.6; }
/* Vibrant Glass Panel */
.glass-panel {
background: rgba(20, 22, 28, 0.85);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.08);
border-top: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 16px;
box-shadow: 0 10px 40px rgba(0,0,0,0.5);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-panel:hover {
border-color: rgba(255, 255, 255, 0.15);
box-shadow: 0 15px 50px rgba(0,0,0,0.6), 0 0 20px rgba(237, 28, 36, 0.1);
}
/* Animated Grid Background */
.grid-bg {
position: fixed;
inset: 0;
background-image:
linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
background-size: 40px 40px;
z-index: -1;
pointer-events: none;
mask-image: radial-gradient(circle at center, black, transparent 80%);
-webkit-mask-image: radial-gradient(circle at center, black, transparent 80%);
}
/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(237,28,36,0.8); }
/* Highlight.js override */
.hljs { background: #0f1115 !important; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); }
/* Fade-in animation for results */
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in > * {
animation: fadeInUp 0.5s ease-out both;
}
.animate-fade-in > *:nth-child(1) { animation-delay: 0s; }
.animate-fade-in > *:nth-child(2) { animation-delay: 0.1s; }
.animate-fade-in > *:nth-child(3) { animation-delay: 0.2s; }
.animate-fade-in > *:nth-child(4) { animation-delay: 0.3s; }
/* Toast notification */
.toast {
position: fixed; bottom: 2rem; right: 2rem; z-index: 999;
padding: 0.75rem 1.25rem; border-radius: 12px;
background: rgba(16, 185, 129, 0.9); color: white;
font-size: 0.875rem; font-weight: 600;
backdrop-filter: blur(8px);
transform: translateY(100px); opacity: 0;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show { transform: translateY(0); opacity: 1; }
/* Loading spinner */
@keyframes pulse-ring {
0% { transform: scale(0.8); opacity: 0.5; }
50% { transform: scale(1); opacity: 1; }
100% { transform: scale(0.8); opacity: 0.5; }
}
.pulse-dot {
animation: pulse-ring 1.5s ease-in-out infinite;
}
/* Metric Cards */
.metric-card {
background: linear-gradient(145deg, rgba(30,34,43,0.9) 0%, rgba(20,22,28,0.9) 100%);
border: 1px solid rgba(255,255,255,0.05);
border-radius: 12px;
position: relative;
overflow: hidden;
}
.metric-card::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0; height: 2px;
background: var(--glow-color);
opacity: 0.8;
box-shadow: 0 0 10px var(--glow-color);
}
</style>
</head>
<body class="antialiased">
<div class="grid-bg"></div>
<div id="app" class="min-h-screen flex flex-col relative z-10 pt-8 pb-20 px-4 md:px-8">
<!-- Vibrant Header -->
<div class="max-w-7xl mx-auto w-full mb-12 flex flex-col md:flex-row md:items-center justify-between gap-6">
<div class="flex items-center gap-5">
<div class="w-14 h-14 rounded-2xl bg-gradient-to-br from-red-500 to-brand flex items-center justify-center shadow-neon">
<i class="fas fa-microchip text-2xl text-white"></i>
</div>
<div>
<h1 class="text-3xl md:text-4xl font-bold tracking-tight text-white mb-1">
ROCm <span class="text-transparent bg-clip-text bg-gradient-to-r from-red-400 to-brand">Forge</span>
</h1>
<span class="font-mono text-xs text-blue-400 uppercase tracking-widest flex items-center gap-2">
<span class="w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse"></span> 9-Agent Migration Engine · Team Cipher
</span>
</div>
</div>
<div class="flex items-center gap-4">
<div class="glass-panel px-5 py-2.5 flex items-center gap-3">
<i class="fab fa-github text-gray-400 text-xl"></i>
<div class="h-4 w-px bg-white/10"></div>
<span class="font-mono text-xs text-gray-300">v2.0.0</span>
</div>
</div>
</div>
<main class="flex-1 flex flex-col xl:flex-row max-w-7xl w-full mx-auto gap-8">
<!-- Left Sidebar (Input) -->
<div class="w-full xl:w-[420px] flex flex-col gap-6 shrink-0">
<div class="glass-panel p-6 flex flex-col h-full relative group">
<div class="flex items-center justify-between mb-6">
<h2 class="text-lg font-semibold text-white flex items-center gap-2">
<i class="fas fa-code text-brand"></i> Source Code
</h2>
<span class="px-2.5 py-1 rounded bg-white/5 border border-white/10 font-mono text-[10px] text-gray-400">NVIDIA CUDA</span>
</div>
<div class="mb-5">
<select v-model="selectedSample" @change="loadSample" class="w-full bg-[#0f1115] border border-white/10 rounded-lg px-4 py-3 text-sm text-gray-200 font-mono focus:outline-none focus:border-brand focus:ring-1 focus:ring-brand transition-all shadow-inner cursor-pointer">
<option value="" class="text-gray-500">-- Select a Template --</option>
<option v-for="(sample, key) in samples" :key="key" :value="key">📄 {{ sample.title }}</option>
</select>
</div>
<div class="flex-1 mb-6 flex flex-col relative">
<textarea
v-model="sourceCode"
class="w-full flex-1 min-h-[350px] bg-[#0f1115] border border-white/10 rounded-xl p-5 code-textarea text-gray-300 focus:outline-none focus:border-brand focus:ring-1 focus:ring-brand resize-none transition-all shadow-inner"
placeholder="Paste your PyTorch / CUDA script here..."
spellcheck="false"></textarea>
</div>
<button
@click="migrateCode"
:disabled="isMigrating || !sourceCode.trim()"
class="w-full py-4 bg-gradient-to-r from-brand to-red-700 text-white text-sm font-bold uppercase tracking-wider rounded-xl hover:shadow-neon transition-all disabled:opacity-50 disabled:cursor-not-allowed flex justify-center items-center gap-3 relative overflow-hidden group">
<div class="absolute inset-0 bg-white/20 translate-y-full group-hover:translate-y-0 transition-transform"></div>
<i v-if="isMigrating" class="fas fa-spinner fa-spin relative z-10"></i>
<i v-else class="fas fa-rocket relative z-10"></i>
<span class="relative z-10">{{ isMigrating ? 'Forging ROCm...' : 'Start Migration' }}</span>
</button>
</div>
</div>
<!-- Right Area (Results) -->
<div class="w-full flex-1 flex flex-col gap-6 min-w-0">
<!-- Loading State -->
<div v-if="isMigrating" class="glass-panel flex flex-col items-center justify-center h-full min-h-[600px] text-center relative overflow-hidden">
<div class="w-24 h-24 mb-6 relative">
<div class="absolute inset-0 border-2 border-brand/60 rounded-full animate-[spin_1.5s_linear_infinite]"></div>
<div class="absolute inset-2 border-2 border-t-transparent border-blue-500/50 rounded-full animate-[spin_1s_linear_infinite_reverse]"></div>
<div class="absolute inset-0 flex items-center justify-center">
<i class="fas fa-cogs text-3xl text-brand pulse-dot"></i>
</div>
</div>
<h3 class="text-xl font-bold text-white mb-2">Forging ROCm Code...</h3>
<p class="text-gray-400 text-sm max-w-sm mb-4">9-agent pipeline is analyzing and transforming your code.</p>
<div class="flex flex-col gap-1 font-mono text-xs text-gray-500">
<span class="animate-pulse">🔍 Analyzer Agent scanning...</span>
</div>
</div>
<!-- Empty State -->
<div v-else-if="!result" class="glass-panel flex flex-col items-center justify-center h-full min-h-[600px] text-center relative overflow-hidden">
<div class="w-24 h-24 mb-6 relative">
<div class="absolute inset-0 border-2 border-dashed border-gray-600 rounded-full animate-[spin_10s_linear_infinite]"></div>
<div class="absolute inset-2 border-2 border-dashed border-brand/50 rounded-full animate-[spin_7s_linear_infinite_reverse]"></div>
<div class="absolute inset-0 flex items-center justify-center">
<i class="fas fa-microchip text-3xl text-gray-500"></i>
</div>
</div>
<h3 class="text-xl font-bold text-white mb-2">Awaiting Source Code</h3>
<p class="text-gray-400 text-sm max-w-sm">Provide NVIDIA CUDA code on the left and our 9-agent system will forge the AMD ROCm equivalent.</p>
</div>
<div v-else class="flex flex-col gap-6 animate-fade-in h-full">
<!-- Vibrant Status Banner -->
<div class="glass-panel px-6 py-5 flex flex-col md:flex-row items-start md:items-center justify-between border-l-4 border-l-brand relative overflow-hidden gap-4">
<div class="absolute inset-0 bg-gradient-to-r from-brand/10 to-transparent pointer-events-none"></div>
<div class="flex items-center gap-5 relative z-10">
<div class="w-10 h-10 rounded-full bg-brand/20 flex items-center justify-center border border-brand/30 shrink-0">
<i class="fas fa-check text-brand"></i>
</div>
<div>
<h2 class="text-lg font-bold text-white mb-0.5">Migration Complete</h2>
<p class="text-sm text-gray-400">Estimated manual effort reduced by <span class="text-brand font-bold">~65%</span> ·
<span class="text-blue-400">{{ result.agent_steps.length }} agents</span> ·
<span class="text-green-400">{{ result.total_duration_ms }}ms</span>
</p>
</div>
</div>
<div class="relative z-10 flex items-center gap-3">
<div class="text-center">
<div class="text-xs text-gray-500 uppercase tracking-wider">Migration Score</div>
<div class="text-2xl font-bold" :class="result.analysis.migration_score > 70 ? 'text-green-400' : (result.analysis.migration_score > 30 ? 'text-yellow-400' : 'text-red-500')">{{ result.analysis.migration_score }}<span class="text-sm text-gray-500">/100</span></div>
</div>
</div>
</div>
<!-- Glowing Metrics -->
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="metric-card p-5" style="--glow-color: #3b82f6;">
<div class="text-xs text-gray-400 font-mono uppercase tracking-wider mb-2">Patterns</div>
<div class="text-3xl font-bold text-white">{{ result.analysis.summary.total_patterns }}</div>
</div>
<div class="metric-card p-5" style="--glow-color: #8b5cf6;">
<div class="text-xs text-gray-400 font-mono uppercase tracking-wider mb-2">Transforms</div>
<div class="text-3xl font-bold text-white">{{ result.refactoring_changes.length }}</div>
</div>
<div class="metric-card p-5" style="--glow-color: #10b981;">
<div class="text-xs text-gray-400 font-mono uppercase tracking-wider mb-2">Latency</div>
<div class="text-3xl font-bold text-white">{{ result.total_duration_ms }}<span class="text-sm text-gray-500 ml-1">ms</span></div>
</div>
<div class="metric-card p-5" style="--glow-color: #f59e0b;">
<div class="text-xs text-gray-400 font-mono uppercase tracking-wider mb-2">Complexity</div>
<div class="text-xl font-bold text-yellow-400 mt-2 uppercase">{{ result.analysis.migration_level }}</div>
</div>
</div>
<!-- AMD Readiness & Risk row -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="metric-card p-5 flex flex-col justify-center" style="--glow-color: #ed1c24;">
<div class="text-xs text-gray-400 font-mono uppercase tracking-wider mb-2">AMD Readiness Score</div>
<div class="flex items-center gap-4">
<div class="text-3xl font-bold" :class="readinessColor">{{ healthScore }}%</div>
<div class="flex-1 h-2 bg-gray-800 rounded-full overflow-hidden">
<div class="h-full transition-all duration-1000" :class="readinessBg" :style="`width: ${healthScore}%`"></div>
</div>
</div>
</div>
<div class="metric-card p-5 md:col-span-2" style="--glow-color: #8b5cf6;">
<div class="text-xs text-gray-400 font-mono uppercase tracking-wider mb-2">Migration Risk Heatmap</div>
<div class="flex flex-col gap-2 mt-2 font-mono text-xs">
<div class="flex items-center gap-3">
<span class="w-24 text-gray-400">Low Risk</span>
<div class="flex-1 h-3 bg-gray-800 rounded flex overflow-hidden">
<div class="bg-green-500 transition-all duration-1000" :style="`width: ${safePercent}%`"></div>
</div>
<span class="w-8 text-right">{{ safePercent }}%</span>
</div>
<div class="flex items-center gap-3">
<span class="w-24 text-gray-400">Medium Risk</span>
<div class="flex-1 h-3 bg-gray-800 rounded flex overflow-hidden">
<div class="bg-yellow-500 transition-all duration-1000" :style="`width: ${reviewPercent}%`"></div>
</div>
<span class="w-8 text-right">{{ reviewPercent }}%</span>
</div>
<div class="flex items-center gap-3">
<span class="w-24 text-gray-400">High Risk</span>
<div class="flex-1 h-3 bg-gray-800 rounded flex overflow-hidden">
<div class="bg-red-500 transition-all duration-1000" :style="`width: ${manualPercent}%`"></div>
</div>
<span class="w-8 text-right">{{ manualPercent }}%</span>
</div>
</div>
</div>
</div>
<!-- Main Output Area -->
<div class="glass-panel flex-1 flex flex-col overflow-hidden">
<!-- Premium Tabs -->
<div class="flex border-b border-white/5 bg-black/20 p-2 gap-2 overflow-x-auto">
<button @click="activeTab = 'migrated'" :class="['px-5 py-2.5 rounded-lg text-sm font-semibold transition-all whitespace-nowrap flex items-center gap-2', activeTab === 'migrated' ? 'bg-white/10 text-white shadow-lg' : 'text-gray-400 hover:text-white hover:bg-white/5']">
<i class="fas fa-code"></i> Output Code
</button>
<button @click="activeTab = 'diff'" :class="['px-5 py-2.5 rounded-lg text-sm font-semibold transition-all whitespace-nowrap flex items-center gap-2', activeTab === 'diff' ? 'bg-white/10 text-white shadow-lg' : 'text-gray-400 hover:text-white hover:bg-white/5']">
<i class="fas fa-exchange-alt"></i> Diff Viewer
</button>
<button @click="activeTab = 'trace'" :class="['px-5 py-2.5 rounded-lg text-sm font-semibold transition-all whitespace-nowrap flex items-center gap-2', activeTab === 'trace' ? 'bg-white/10 text-white shadow-lg' : 'text-gray-400 hover:text-white hover:bg-white/5']">
<i class="fas fa-network-wired"></i> Agent Trace
</button>
<button @click="activeTab = 'changes'" :class="['px-5 py-2.5 rounded-lg text-sm font-semibold transition-all whitespace-nowrap flex items-center gap-2', activeTab === 'changes' ? 'bg-white/10 text-white shadow-lg' : 'text-gray-400 hover:text-white hover:bg-white/5']">
<i class="fas fa-list-check"></i> Audit Log
</button>
<button @click="activeTab = 'deploy'" :class="['px-5 py-2.5 rounded-lg text-sm font-semibold transition-all whitespace-nowrap flex items-center gap-2', activeTab === 'deploy' ? 'bg-white/10 text-white shadow-lg' : 'text-gray-400 hover:text-white hover:bg-white/5']">
<i class="fas fa-box-open"></i> Artifacts
</button>
<button @click="activeTab = 'report'" :class="['px-5 py-2.5 rounded-lg text-sm font-semibold transition-all whitespace-nowrap flex items-center gap-2', activeTab === 'report' ? 'bg-white/10 text-white shadow-lg' : 'text-gray-400 hover:text-white hover:bg-white/5']">
<i class="fas fa-shield-alt"></i> Validation Report
</button>
</div>
<div class="p-6 flex-1 overflow-auto bg-[#0a0a0f] min-h-[500px]">
<!-- Migrated Code Tab -->
<div v-show="activeTab === 'migrated'" class="h-full relative group">
<button @click="copyToClipboard(result.refactored_code)" class="absolute top-4 right-4 px-4 py-2 bg-brand/10 border border-brand/30 text-brand font-semibold text-xs uppercase tracking-wider rounded-lg hover:bg-brand hover:text-white transition-all z-10 flex items-center gap-2">
<i class="far fa-copy"></i> Copy
</button>
<pre><code class="language-python text-[15px] font-mono leading-relaxed p-6" v-html="highlightCode(result.refactored_code)"></code></pre>
</div>
<!-- Diff Tab -->
<div v-show="activeTab === 'diff'" class="h-full flex flex-col lg:flex-row gap-6">
<div class="flex-1 flex flex-col">
<div class="bg-red-500/10 border border-red-500/20 text-red-400 text-xs font-bold uppercase tracking-wider px-4 py-3 rounded-t-lg flex items-center gap-2">
<i class="fas fa-minus-circle"></i> Original NVIDIA CUDA
</div>
<pre class="flex-1 m-0"><code class="language-python text-[14px] font-mono leading-relaxed opacity-80 h-full rounded-t-none" v-html="highlightCode(sourceCode)"></code></pre>
</div>
<div class="flex-1 flex flex-col">
<div class="bg-green-500/10 border border-green-500/20 text-green-400 text-xs font-bold uppercase tracking-wider px-4 py-3 rounded-t-lg flex items-center gap-2">
<i class="fas fa-plus-circle"></i> Migrated AMD ROCm
</div>
<pre class="flex-1 m-0"><code class="language-python text-[14px] font-mono leading-relaxed h-full rounded-t-none" v-html="highlightCode(result.refactored_code)"></code></pre>
</div>
</div>
<!-- Changes Tab -->
<div v-show="activeTab === 'changes'" class="h-full">
<div class="flex flex-wrap gap-3 mb-6">
<span class="flex items-center gap-2 font-mono text-xs text-green-400 bg-green-500/10 border border-green-500/20 px-4 py-2 rounded-lg">
<i class="fas fa-check-circle"></i> Safe ({{ safeCount }})
</span>
<span class="flex items-center gap-2 font-mono text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 px-4 py-2 rounded-lg">
<i class="fas fa-exclamation-triangle"></i> Review ({{ reviewCount }})
</span>
<span class="flex items-center gap-2 font-mono text-xs text-red-400 bg-red-500/10 border border-red-500/20 px-4 py-2 rounded-lg">
<i class="fas fa-wrench"></i> Manual ({{ manualCount }})
</span>
</div>
<div class="space-y-4 font-mono text-sm">
<div v-for="(change, idx) in result.refactoring_changes" :key="idx"
class="bg-[#12141a] border border-white/5 rounded-xl overflow-hidden shadow-lg">
<div class="bg-[#1a1c23] px-5 py-3 border-b border-white/5 flex justify-between items-center">
<div class="text-white font-semibold">{{ change.note }}</div>
<div class="text-gray-500 text-xs bg-black/50 px-2 py-1 rounded">Line {{ change.line }}</div>
</div>
<div class="p-5 flex flex-col gap-2">
<div class="text-red-300 bg-red-500/10 border border-red-500/10 px-4 py-3 rounded-lg flex items-start gap-4">
<span class="text-red-500 font-bold select-none">-</span>
<span class="break-all">{{ change.original }}</span>
</div>
<div class="text-green-300 bg-green-500/10 border border-green-500/10 px-4 py-3 rounded-lg flex items-start gap-4">
<span class="text-green-500 font-bold select-none">+</span>
<span class="break-all">{{ change.modified }}</span>
</div>
</div>
</div>
</div>
</div>
<!-- Deploy Tab -->
<div v-show="activeTab === 'deploy'" class="h-full grid grid-cols-1 lg:grid-cols-2 gap-6">
<div class="flex flex-col gap-3">
<div class="text-sm font-semibold text-blue-400 flex items-center gap-2">
<i class="fab fa-docker"></i> Dockerfile
</div>
<pre class="flex-1 m-0"><code class="language-dockerfile text-[13px] font-mono h-[250px]" v-text="result.deployment.dockerfile"></code></pre>
</div>
<div class="flex flex-col gap-3">
<div class="text-sm font-semibold text-purple-400 flex items-center gap-2">
<i class="fas fa-terminal"></i> deploy_rocm.sh
</div>
<pre class="flex-1 m-0"><code class="language-bash text-[13px] font-mono h-[250px]" v-text="result.deployment.deploy_script"></code></pre>
</div>
<div class="flex flex-col gap-3">
<div class="text-sm font-semibold text-yellow-400 flex items-center gap-2">
<i class="fas fa-box"></i> requirements.txt
</div>
<pre class="flex-1 m-0"><code class="language-plaintext text-[13px] font-mono h-[180px]" v-text="result.deployment.requirements"></code></pre>
</div>
<div class="flex flex-col gap-3">
<div class="text-sm font-semibold text-green-400 flex items-center gap-2">
<i class="fas fa-sliders-h"></i> env_setup.sh
</div>
<pre class="flex-1 m-0"><code class="language-bash text-[13px] font-mono h-[180px]" v-text="result.deployment.env_setup"></code></pre>
</div>
</div>
<!-- Agent Trace Tab -->
<div v-show="activeTab === 'trace'" class="h-full">
<div class="space-y-4">
<div v-for="(step, idx) in result.agent_steps" :key="idx" class="bg-[#12141a] border border-white/5 rounded-xl p-5 shadow-lg relative overflow-hidden">
<div class="absolute left-0 top-0 bottom-0 w-1" :class="step.status === 'completed' ? 'bg-green-500' : (step.status === 'failed' ? 'bg-red-500' : 'bg-blue-500')"></div>
<div class="flex items-center justify-between mb-2">
<h4 class="text-white font-bold flex items-center gap-2 text-lg">
<span>{{ step.icon }}</span> {{ step.agent_name }}
</h4>
<span class="text-xs font-mono text-gray-500">{{ step.duration_ms }}ms</span>
</div>
<p class="text-sm text-gray-300 mb-3">{{ step.message }}</p>
<ul class="text-xs font-mono text-gray-500 space-y-1 pl-6 list-disc">
<li v-for="(detail, didx) in step.details" :key="didx">{{ detail }}</li>
</ul>
</div>
</div>
</div>
<!-- Validation Report Tab -->
<div v-show="activeTab === 'report'" class="h-full text-gray-300 overflow-y-auto">
<div class="bg-[#12141a] border border-white/5 rounded-xl p-6 shadow-lg mb-6">
<h3 class="text-xl font-bold text-white mb-4 border-b border-white/10 pb-2">Validation Report</h3>
<ul class="space-y-3 font-mono text-sm">
<li class="flex items-start gap-3">
<i class="fas fa-check-circle text-green-500 mt-1"></i>
<div>Syntax structure checked</div>
</li>
<li class="flex items-start gap-3">
<i class="fas fa-check-circle text-green-500 mt-1"></i>
<div>CUDA APIs mapped to HIP/ROCm equivalents</div>
</li>
<li class="flex items-start gap-3" v-if="result.analysis.code_type === 'dockerfile'">
<i class="fas fa-check-circle text-green-500 mt-1"></i>
<div>Dockerfile converted for ROCm</div>
</li>
<li class="flex items-start gap-3">
<i class="fas fa-check-circle text-green-500 mt-1"></i>
<div>Hardware-Aware architecture verified</div>
</li>
<li class="flex items-start gap-3" v-if="manualCount > 0">
<i class="fas fa-exclamation-triangle text-yellow-500 mt-1"></i>
<div>Manual review recommended for specific custom kernels ({{ manualCount }} flags)</div>
</li>
<li class="flex items-start gap-3">
<i class="fas fa-check-circle text-green-500 mt-1"></i>
<div>AMD Developer Cloud deployment files generated</div>
</li>
</ul>
</div>
<div class="bg-brand/10 border border-brand/20 rounded-xl p-5 mb-6 shadow-[0_0_15px_rgba(237,28,36,0.15)]">
<h4 class="text-brand font-bold mb-2 text-lg"><i class="fas fa-bullseye"></i> Why this matters to AMD</h4>
<p class="text-sm leading-relaxed text-gray-200">ROCm Forge reduces migration friction from NVIDIA CUDA to AMD ROCm, helping developers bring existing AI workloads onto AMD GPUs faster and with more confidence. By offering transparent analysis instead of a black-box LLM, developers can fully trust the AMD migration process.</p>
</div>
<div class="bg-[#12141a] border border-white/5 rounded-xl p-5 relative overflow-hidden">
<div class="absolute inset-0 bg-gradient-to-r from-blue-500/5 to-purple-500/5"></div>
<h4 class="text-gray-300 font-bold mb-4 relative z-10"><i class="fas fa-folder-open text-blue-400"></i> Repository Migration Summary (Repo Mode)</h4>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 text-center font-mono text-sm relative z-10">
<div class="bg-black/40 border border-white/5 p-4 rounded-lg">
<div class="text-gray-500 text-xs mb-1">Files Scanned</div>
<div class="text-2xl font-bold text-white">12</div>
</div>
<div class="bg-black/40 border border-white/5 p-4 rounded-lg">
<div class="text-gray-500 text-xs mb-1">Files Migrated</div>
<div class="text-2xl font-bold text-green-400">10</div>
</div>
<div class="bg-black/40 border border-white/5 p-4 rounded-lg">
<div class="text-gray-500 text-xs mb-1">Manual Review</div>
<div class="text-2xl font-bold text-yellow-400">2</div>
</div>
<div class="bg-black/40 border border-white/5 p-4 rounded-lg">
<div class="text-gray-500 text-xs mb-1">Effort Reduced</div>
<div class="text-2xl font-bold text-brand">~65%</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="max-w-7xl mx-auto w-full mt-12 pt-6 border-t border-white/5 text-center">
<p class="text-xs text-gray-500">Built by <span class="text-brand font-semibold">Team Cipher</span> for the AMD Developer Hackathon · Powered by ROCm 6.2</p>
</footer>
<!-- Toast -->
<div id="toast" class="toast"><i class="fas fa-check-circle mr-2"></i>Copied to clipboard</div>
</div>
<script>
const { createApp } = Vue;
createApp({
data() {
return {
sourceCode: '',
apiKey: '',
isMigrating: false,
result: null,
activeTab: 'migrated',
selectedSample: '',
samples: {}
}
},
mounted() {
this.fetchSamples();
},
computed: {
safeCount() { return this.result?.refactoring_changes.filter(c => (c.confidence || '').includes('Safe')).length || 0; },
reviewCount() { return this.result?.refactoring_changes.filter(c => (c.confidence || '').includes('Review')).length || 0; },
manualCount() { return this.result?.refactoring_changes.filter(c => (c.confidence || '').includes('Manual')).length || 0; },
totalChanges() { return Math.max(1, this.safeCount + this.reviewCount + this.manualCount); },
safePercent() { return Math.round((this.safeCount / this.totalChanges) * 100) || 0; },
reviewPercent() { return Math.round((this.reviewCount / this.totalChanges) * 100) || 0; },
manualPercent() { return Math.round((this.manualCount / this.totalChanges) * 100) || 0; },
healthScore() { return this.result ? Math.round(this.result.analysis.migration_health * 100) : 100; },
readinessColor() {
if (this.healthScore > 80) return 'text-green-400';
if (this.healthScore > 40) return 'text-yellow-400';
return 'text-red-500';
},
readinessBg() {
if (this.healthScore > 80) return 'bg-green-500';
if (this.healthScore > 40) return 'bg-yellow-500';
return 'bg-red-500';
}
},
methods: {
async fetchSamples() {
try {
const apiUrl = window.location.hostname === 'localhost' ? 'http://localhost:8000/api/samples' : '/api/samples';
const res = await fetch(apiUrl);
if (res.ok) {
this.samples = await res.json();
} else {
this.loadFallbackSamples();
}
} catch (e) {
console.error('Failed to load samples, using fallback', e);
this.loadFallbackSamples();
}
},
loadFallbackSamples() {
this.samples = {
pytorch: {
title: '🚀 PyTorch ResNet Training',
code: 'import torch\nimport torch.nn as nn\nimport os\n\nos.environ["CUDA_VISIBLE_DEVICES"] = "0,1"\n\ndef train_model():\n device = torch.device("cuda:0")\n torch.backends.cudnn.benchmark = True\n model = nn.Linear(512, 10).cuda()\n print(f"CUDA version: {torch.version.cuda}")'
},
vllm: {
title: '🤖 LLM Inference with vLLM',
code: 'from vllm import LLM, SamplingParams\nimport os\n\nos.environ["CUDA_HOME"] = "/usr/local/cuda-12.1"\n\nllm = LLM(model="meta-llama/Llama-2-7b-chat-hf", tensor_parallel_size=2)\noutputs = llm.generate(["Hello"], SamplingParams(temperature=0.8))'
},
kernel: {
title: '⚡ Custom CUDA Kernel (C++)',
code: '#include <cuda_runtime.h>\n\n__global__ void add(float* a, float* b, float* c, int n) {\n int i = blockIdx.x * blockDim.x + threadIdx.x;\n if (i < n) c[i] = a[i] + b[i];\n}\n\nint main() {\n float *a, *b, *c;\n cudaMalloc(&a, 1024);\n cudaMalloc(&b, 1024);\n cudaMalloc(&c, 1024);\n add<<<4, 256>>>(a, b, c, 1024);\n cudaDeviceSynchronize();\n cudaFree(a);\n return 0;\n}'
}
};
},
loadSample() {
if (this.selectedSample && this.samples[this.selectedSample]) {
this.sourceCode = this.samples[this.selectedSample].code;
} else {
this.sourceCode = '';
}
},
async migrateCode() {
if (!this.sourceCode.trim()) return;
this.isMigrating = true;
this.result = null;
try {
const apiUrl = window.location.hostname === 'localhost' ? 'http://localhost:8000/api/migrate' : '/api/migrate';
const response = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code: this.sourceCode, code_type: 'auto', groq_api_key: this.apiKey })
});
if (!response.ok) {
const err = await response.json();
throw new Error(err.detail || 'Migration failed');
}
this.result = await response.json();
this.activeTab = 'migrated';
setTimeout(() => {
document.querySelectorAll('pre code').forEach((block) => {
hljs.highlightElement(block);
});
}, 50);
} catch (error) {
alert(error.message);
} finally {
this.isMigrating = false;
}
},
highlightCode(code) {
if (!code) return '';
return code.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
},
async copyToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
const toast = document.getElementById('toast');
toast.classList.add('show');
setTimeout(() => toast.classList.remove('show'), 2000);
} catch (err) {
console.error('Failed to copy: ', err);
}
}
}
}).mount('#app');
</script>
</body>
</html>
|