ROCm-Forge / static /index.html
iwilldoit's picture
polish: premium UI upgrades for hackathon demo
91b1e2c
Raw
History Blame Contribute Delete
45.4 kB
<!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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
},
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>