Skip to content

Commit e3553aa

Browse files
authored
Update 4-run-migration.md
1 parent dce6ad6 commit e3553aa

1 file changed

Lines changed: 46 additions & 32 deletions

File tree

content/learning-paths/servers-and-cloud-computing/docker-mcp-toolkit/4-run-migration.md

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ cd docker-blog-arm-migration
1515
code .
1616
```
1717

18-
Make sure the MCP_DOCKER server is running in VS Code (check **Extensions** > **MCP_DOCKER** > **Start Server** if needed).
18+
Make sure the MCP_DOCKER server is running in VS Code ( Use **Extensions** > **MCP_DOCKER** > **Start Server** if needed).
1919

20-
## Give GitHub Copilot migration instructions
20+
This allows GitHub Copilot to invoke the configured MCP servers through the MCP Gateway.
21+
22+
## Provide migration instructions to GitHub Copilot
2123

2224
Open GitHub Copilot Chat in VS Code and paste the following prompt:
2325

@@ -48,22 +50,24 @@ After completing the migration:
4850
- Include performance predictions and cost savings in the PR description
4951
- List all tools used and validation steps needed
5052
```
53+
This prompt instructs Copilot to use structured MCP tools rather than relying purely on generated suggestions.
5154

52-
## Watch the migration execute
55+
## Observe the migration workflow
5356

54-
GitHub Copilot orchestrates the migration through four phases using the Docker MCP Toolkit.
57+
Copilot now orchestrates the migration using the configured MCP servers. The workflow typically proceeds in several phases.
5558

56-
### Phase 1: Image analysis
59+
### Phase 1: Container Image analysis
5760

58-
Copilot uses the `skopeo` tool from the Arm MCP Server to analyze the base image:
61+
Copilot invokes `check_image` or `skopeo` from the Arm MCP Server:
5962

6063
```text
6164
Checking centos:6 for arm64 support...
6265
```
6366

64-
The tool reports that `centos:6` has no `linux/arm64` build available. This is the first blocker identified. Copilot determines that the base image must be replaced.
67+
The tool reports that `centos:6` has no `linux/arm64` build available. Copilot proposes replacing the base image with a modern multi-architecture alternative.
68+
This step ensures the container can build and run on Arm hardware before addressing source-level changes.
6569

66-
### Phase 2: Code scanning
70+
### Phase 2: Source Code scanning
6771

6872
Copilot runs the `migrate_ease_scan` tool with the C++ scanner:
6973

@@ -77,17 +81,18 @@ The scan detects:
7781
- The `-mavx2` compiler flag in the Dockerfile.
7882
- The x86-specific header `<immintrin.h>`.
7983

80-
Each issue includes the file location, line number, and specific code requiring modification.
84+
Each finding includes file locations and recommended actions. This structured scan avoids manually searching through the codebase.
8185

82-
### Phase 3: Knowledge base lookup and code conversion
86+
### Phase 3: Knowledge base lookup and refactoring code
8387

8488
For each x86 intrinsic found, Copilot queries the Arm MCP Server knowledge base:
8589

8690
```text
8791
Searching knowledge base for: AVX2 to NEON intrinsic conversion
8892
```
8993

90-
The knowledge base returns Arm documentation with the conversions:
94+
The Arm MCP knowledge base provides documented guidance on intrinsic mapping and architecture considerations.
95+
Example mappings:
9196

9297
| x86 AVX2 Intrinsic | Arm NEON Equivalent |
9398
|---------------------|---------------------|
@@ -96,37 +101,46 @@ The knowledge base returns Arm documentation with the conversions:
96101
| `_mm256_add_pd()` | Two `vaddq_f64()` operations |
97102
| `_mm256_mul_pd()` | Two `vmulq_f64()` operations |
98103

99-
The knowledge base also explains that AVX2 uses 256-bit vectors processing 4 doubles at once, while NEON uses 128-bit vectors processing 2 doubles. Loop strides must be adjusted accordingly.
100-
101-
Copilot rewrites the code using this information:
102-
103-
- Replaces `<immintrin.h>` with `<arm_neon.h>` inside `#ifdef __aarch64__` guards.
104-
- Converts the AVX2 loop structure (stride 4) to NEON (stride 2).
105-
- Rewrites the horizontal reduction for NEON.
106-
- Updates the Dockerfile to use `ubuntu:22.04` with `TARGETARCH` for multi-arch builds.
107-
- Changes the compiler flag from `-mavx2` to `-march=armv8-a+simd`.
108-
109-
### Phase 4: Create the pull request
110-
111-
Copilot uses the GitHub MCP Server to create a pull request with:
112-
113-
- All code changes (source files and Dockerfile).
114-
- A detailed description of what was changed and why.
115-
- Performance predictions for Arm.
116-
- A list of all MCP tools used during the migration.
104+
Because AVX2 operates on 256-bit vectors (four doubles) and NEON operates on 128-bit vectors (two doubles), Copilot adjusts:
105+
- Loop stride
106+
- Accumulation logic
107+
- Horizontal reduction pattern
108+
-
109+
The refactoring typically includes:
110+
- Guarding architecture-specific code with #ifdef __aarch64__
111+
- Replacing <immintrin.h> with <arm_neon.h> where appropriate
112+
- Updating compiler flags (for example replacing -mavx2)
113+
- Selecting an Arm-compatible base image such as ubuntu:22.04
114+
- Supporting multi-architecture builds using TARGETARCH
115+
116+
All proposed changes should be reviewed before merging.
117+
118+
### Phase 4: Pull request creation
119+
120+
Once modifications are complete, Copilot invokes the GitHub MCP Server to:
121+
- Create a branch
122+
- Commit changes
123+
- Open a pull request
124+
125+
The PR typically includes:
126+
- Updated Dockerfile
127+
- Refactored source files
128+
- A description of the changes
129+
- A summary of MCP tools used
130+
- Suggested validation steps for Arm hardware
117131

118132
You can see an example PR at [github.com/JoeStech/docker-blog-arm-migration/pull/1](https://github.com/JoeStech/docker-blog-arm-migration/pull/1).
119133

120134
## Summary of changes
121135

122-
The migration produces these key changes:
136+
After migration, you should see:
123137

124-
**Dockerfile**:
138+
**Dockerfile updates**:
125139
- Replaced `centos:6` with `ubuntu:22.04`.
126140
- Added `TARGETARCH` for multi-architecture builds.
127141
- Changed `-mavx2` to `-march=armv8-a+simd` for Arm builds.
128142

129-
**Source code**:
143+
**Source code updates**:
130144
- Added `#ifdef __aarch64__` architecture guards.
131145
- Replaced all `_mm256_*` AVX2 intrinsics with NEON equivalents (`vld1q_f64`, `vaddq_f64`, `vmulq_f64`).
132146
- Adjusted loop strides from 4 (AVX2) to 2 (NEON).

0 commit comments

Comments
 (0)