Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/writing-style-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Writing Style Check

on:
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to check'
required: true
type: string

jobs:
style-check:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for comparing changes

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install textblob nltk spacy
python -m spacy download en_core_web_sm

- name: Fetch PR files
id: fetch-pr
run: |
PR_NUMBER=${{ github.event.inputs.pr_number }}
echo "Checking PR #${PR_NUMBER}"
git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER}
git checkout pr-${PR_NUMBER}

- name: List changed files
id: changed-files
run: |
PR_NUMBER=${{ github.event.inputs.pr_number }}
echo "Changed files in PR #${PR_NUMBER}:"
git diff --name-only origin/main...pr-${PR_NUMBER} | grep '\.md$' || echo "No markdown files changed"

- name: Run style guide checker
id: style-check
run: |
python tools/style_checker.py
env:
PR_NUMBER: ${{ github.event.inputs.pr_number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create suggestions as comments
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
if (!fs.existsSync('style_suggestions.json')) {
console.log('No suggestions found');
return;
}

const suggestions = JSON.parse(fs.readFileSync('style_suggestions.json', 'utf8'));
console.log(`Found ${suggestions.length} style suggestions`);

const prNumber = process.env.PR_NUMBER || '${{ github.event.inputs.pr_number }}';

// Add sleep function to add delay between API calls
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));

for (const suggestion of suggestions) {
const { file, line, original, suggested, reason } = suggestion;

try {
// Get PR data to ensure we have the correct commit SHA
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt(prNumber)
});
const headSha = pr.head.sha;

await github.rest.pulls.createReviewComment({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: parseInt(prNumber),
commit_id: headSha,
path: file,
body: `**Style Guide Suggestion:**\n\nReason: ${reason}\n\n\`\`\`suggestion\n${suggested}\n\`\`\``,
line: line,
side: 'RIGHT'
});
console.log(`Created suggestion for ${file}:${line}`);

// Add a delay of 2 seconds between comments to avoid rate limiting
await sleep(2000);
} catch (error) {
console.error(`Error creating comment for ${file}:${line}: ${error.message}`);
}
}
env:
PR_NUMBER: ${{ github.event.inputs.pr_number }}
52 changes: 52 additions & 0 deletions content/learning-paths/cross-platform/amazon-q-arm/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Using Amazon Q for Arm Development

description: Learn how to leverage Amazon Q to accelerate your Arm-based software development workflow.

minutes_to_complete: 30

who_is_this_for: Software developers working with Arm architecture who want to improve productivity using AI assistance.

learning_objectives:
- Understand how Amazon Q can assist with Arm development tasks
- Set up Amazon Q for your Arm development environment
- Use Amazon Q to optimize code for Arm architecture
- Troubleshoot common Arm development issues with Amazon Q

prerequisites:
- Basic familiarity with software development
- An AWS account (free tier is sufficient)

author: Sample Author

### Tags
skilllevels: Introductory
subjects:
- AI/ML
armips:
- All
operatingsystems:
- Linux
- Windows
- macOS
tools_software_languages:
- Amazon Q
- Python
- C/C++

further_reading:
- resource:
title: Amazon Q Developer Documentation
link: https://aws.amazon.com/q/
type: website
- resource:
title: Arm Developer Documentation
link: https://developer.arm.com/
type: website

### FIXED, DO NOT MODIFY
# ================================================================================
weight: 1 # _index.md always has weight of 1 to order correctly
layout: "learningpathall" # All files under learning paths have this same wrapper
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
---
33 changes: 33 additions & 0 deletions content/learning-paths/cross-platform/amazon-q-arm/_next-steps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# ================================================================================
# Edit
# ================================================================================

next_step_guidance: |
Now that you've learned how to use Amazon Q for Arm development, you might want to explore:
1. Advanced optimization techniques for specific Arm processors
2. Integrating Amazon Q with CI/CD pipelines for Arm builds
3. Using Amazon Q with other AWS services optimized for Arm

# (string) link to the next page
next_steps_links:
- title: "Optimizing Python for Arm"
url: "/learning-paths/cross-platform/python-arm/"
- title: "AWS Graviton Performance Optimization"
url: "/learning-paths/servers-and-cloud-computing/graviton/"
- title: "Cross-Platform Development with Docker on Arm"
url: "/learning-paths/cross-platform/docker-arm/"

# (string) 1-5 sentence recommendation outlining how the reader can generally keep learning about these topics, and a specific explanation of why the next step is being recommended.
recommended_path: "To continue your journey with Arm development, we recommend exploring AWS Graviton Performance Optimization. This will help you apply the Amazon Q knowledge you've gained to optimize workloads on Arm-based cloud instances."

# (string) 1-5 sentence conclusion summarizing the key points of the learning path and how the reader should feel after completing it
conclusion: "You've now learned how to leverage Amazon Q to accelerate your Arm development workflow. By using AI assistance for code generation, optimization, and troubleshooting, you can develop more efficient applications for Arm architecture while saving time and effort. Continue exploring the capabilities of Amazon Q as you work on more complex Arm projects."

# ================================================================================
# FIXED, DO NOT MODIFY
# ================================================================================
weight: 7
title: "Next Steps"
layout: "learningpathall"
---
106 changes: 106 additions & 0 deletions content/learning-paths/cross-platform/amazon-q-arm/best-practices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
# User change
title: "Best Practices for Using Amazon Q with Arm"

weight: 6 # 1 is first, 2 is second, etc.

# Do not modify these elements
layout: "learningpathall"
---

To get the most out of Amazon Q for your Arm development projects, follow these best practices and tips.

## Effective prompting for Arm development

The quality of Amazon Q's responses depends significantly on how you phrase your questions. Here are some tips for effective prompting:

1. **Be specific about architecture details**:
- Instead of: "How do I optimize this code?"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimize' with 'improve'.

Suggested change
- Instead of: "How do I optimize this code?"
- Instead of: "How do I improve this code?"

- Try: "How do I optimize this code for ARMv8-A with NEON?"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimize' with 'improve'.

Suggested change
- Try: "How do I optimize this code for ARMv8-A with NEON?"
- Try: "How do I improve this code for ARMv8-A with NEON?"


2. **Provide context about your target system**:
- "I'm developing for a Raspberry Pi 4 (Cortex-A72)"
- "This code will run on AWS Graviton3 instances"

3. **Mention performance goals**:
- "I need to optimize for power efficiency on an Arm-based IoT device"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimize' with 'improve'.

Suggested change
- "I need to optimize for power efficiency on an Arm-based IoT device"
- "I need to improve for power efficiency on an Arm-based IoT device"

- "I'm trying to maximize throughput on an Arm server"

4. **Reference specific Arm technologies**:
- "How can I use SVE2 instructions for this algorithm?"
- "What's the best way to implement this using Arm Helium technology?"

## Integrating Amazon Q into your development workflow

Here are strategies for incorporating Amazon Q into your Arm development process:

### During design phase
- Use Amazon Q to explore Arm-specific architectural considerations
- Ask for advice on algorithm selection based on Arm capabilities
- Get recommendations for libraries optimized for Arm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimized' with 'improved'.

Suggested change
- Get recommendations for libraries optimized for Arm
- Get recommendations for libraries improved for Arm


### During implementation
- Generate starter code optimized for Arm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimized' with 'improved'.

Suggested change
- Generate starter code optimized for Arm
- Generate starter code improved for Arm

- Request examples of Arm-specific optimizations

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimizations' with 'improvements'.

Suggested change
- Request examples of Arm-specific optimizations
- Request examples of Arm-specific improvements

- Convert existing x86 code to Arm-optimized versions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimized' with 'improved'.

Suggested change
- Convert existing x86 code to Arm-optimized versions
- Convert existing x86 code to Arm-improved versions


### During debugging
- Get help interpreting Arm-specific error messages
- Analyze performance bottlenecks on Arm systems
- Troubleshoot cross-compilation issues

### During optimization
- Request SIMD optimization suggestions using NEON or SVE

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimization' with 'improvement'.

Suggested change
- Request SIMD optimization suggestions using NEON or SVE
- Request SIMD improvement suggestions using NEON or SVE

- Get advice on memory access patterns for Arm's cache hierarchy
- Explore Arm-specific compiler flags and options

## Verifying Amazon Q suggestions

While Amazon Q provides valuable assistance, always verify its suggestions:

1. **Test on actual Arm hardware** or emulators to confirm performance improvements
2. **Benchmark before and after** applying Amazon Q's optimization suggestions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimization' with 'improvement'.

Suggested change
2. **Benchmark before and after** applying Amazon Q's optimization suggestions
2. **Benchmark before and after** applying Amazon Q's improvement suggestions

3. **Review generated code** for correctness and security issues
4. **Consult official Arm documentation** to verify architectural details

## Handling limitations

Be aware of Amazon Q's limitations when working with Arm:

1. **Cutting-edge features**: Amazon Q might not be fully updated on the newest Arm technologies
2. **Specialized domains**: For highly specialized Arm applications, Amazon Q might provide general advice
3. **Hardware-specific optimizations**: Some optimizations depend on specific Arm implementations

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimizations' with 'improvements'.

Suggested change
3. **Hardware-specific optimizations**: Some optimizations depend on specific Arm implementations
3. **Hardware-specific improvements**: Some improvements depend on specific Arm implementations


When you encounter these limitations:

- Ask Amazon Q to explain its reasoning
- Request references to official documentation
- Break complex problems into smaller, more specific questions

## Security considerations

When using Amazon Q for development:

1. **Don't share sensitive code** or proprietary algorithms
2. **Review generated code** for security vulnerabilities
3. **Don't rely on Amazon Q for security-critical implementations** without thorough review

## Continuous learning

To maximize the benefits of using Amazon Q with Arm:

1. **Stay updated on Arm architecture**: Familiarize yourself with the latest Arm features
2. **Learn Arm optimization principles**: Understanding the fundamentals helps you evaluate Amazon Q's suggestions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimization' with 'improvement'.

Suggested change
2. **Learn Arm optimization principles**: Understanding the fundamentals helps you evaluate Amazon Q's suggestions
2. **Learn Arm improvement principles**: Understanding the fundamentals helps you evaluate Amazon Q's suggestions

3. **Share knowledge**: Contribute your learnings back to the community

## Example workflow

Here's an example of an effective workflow using Amazon Q for Arm development:

1. **Initial exploration**: "What are the key considerations when porting my application to Arm64?"
2. **Architecture-specific guidance**: "How should I structure my data for optimal cache usage on Arm Cortex-A76?"
3. **Implementation assistance**: "Generate a NEON-optimized version of this image processing function"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimized' with 'improved'.

Suggested change
3. **Implementation assistance**: "Generate a NEON-optimized version of this image processing function"
3. **Implementation assistance**: "Generate a NEON-improved version of this image processing function"

4. **Debugging help**: "Why might this code cause unaligned access exceptions on Arm but not x86?"
5. **Performance tuning**: "How can I further optimize this code for Arm Neoverse N1?"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style suggestion: Simplify language by replacing 'optimize' with 'improve'.

Suggested change
5. **Performance tuning**: "How can I further optimize this code for Arm Neoverse N1?"
5. **Performance tuning**: "How can I further improve this code for Arm Neoverse N1?"


By following these best practices, you can effectively leverage Amazon Q to enhance your Arm development process and create more efficient, high-performance applications.
Loading
Loading