Skip to content

v1.2.1

Choose a tag to compare

@muditbhargava66 muditbhargava66 released this 02 Sep 07:22
· 11 commits to main since this release

Cache Simulator v1.2.1 Release Notes

Release Date: September 2, 2025
Type: Bugfix Release
GitHub Issue: #3

🐛 Bug Fixes

Critical Fix: Multiprocessor Configuration Support

Issue: Division by zero error when running multiprocessor configurations

  • Command that was failing: ./build/bin/cachesim --config configs/multiprocessor_4core.json traces/multiprocessor_coherence.txt
  • Error: numSets = size / (associativity * blockSize); resulted in division by zero at line 34 in cache.cpp

Root Cause Analysis

The issue had two main components:

  1. JSON Parser Limitation: The configuration parser couldn't handle nested JSON objects like perCoreL1 and sharedL2
  2. Trace Format Incompatibility: The trace parser expected 2-token format but multiprocessor traces use 3-token format with processor ID

Solutions Implemented

1. Enhanced JSON Configuration Parser (src/utils/config_utils.cpp)

  • Added support for nested JSON objects in configuration files
  • Handles both perCoreL1/sharedL2 and l1/l2 section formats
  • Properly parses cache configuration parameters from nested structures
  • Added comprehensive validation to prevent division by zero errors
  • Maintains backward compatibility with existing configuration formats

2. Updated Trace Parser (src/utils/trace_parser.cpp)

  • Modified parseLine() to handle both 2-token and 3-token trace formats
  • Automatically detects multiprocessor format with processor ID prefix
  • Maintains full backward compatibility with existing trace formats
  • Supports format: <processor_id> <r/w> <address> and <r/w> <address>

Testing Results

Before Fix

$ ./build/bin/cachesim --config configs/multiprocessor_4core.json traces/multiprocessor_coherence.txt
libc++abi: terminating due to uncaught exception of type cachesim::CacheConfigError: 
Cache configuration error: Invalid configuration: number of sets must be positive
zsh: abort

After Fix

$ ./build/bin/cachesim --config configs/multiprocessor_4core.json traces/multiprocessor_coherence.txt
[INFO] Starting cache simulation
[INFO] Processing trace file...
[INFO] Finished processing 80 memory accesses in 0 ms

Cache Simulation Results
=======================
Total Memory Accesses: 80
L1 Hit Ratio: 52.50%
L2 Hit Ratio: 41.76%
✅ SUCCESS: Simulation completed successfully

Technical Details

Files Modified

  • src/utils/config_utils.cpp - Enhanced JSON parsing for nested objects
  • src/utils/trace_parser.cpp - Added multiprocessor trace format support

Configuration Formats Supported

  • Standard format: {"l1": {...}, "l2": {...}}
  • Multiprocessor format: {"perCoreL1": {...}, "sharedL2": {...}}
  • Legacy flat format: {"l1_size": 32768, "l1_assoc": 4, ...}

Trace Formats Supported

  • Standard format: r 0x10000 or w 0x20000
  • Multiprocessor format: 0 r 0x10000 or 1 w 0x20000
  • JSON format: {"type": "r", "address": "0x10000"}

Compatibility

Backward Compatibility

  • All existing configuration files continue to work
  • All existing trace files continue to work
  • No breaking changes to API or command-line interface
  • All existing functionality preserved

Tested Configurations

  • configs/multiprocessor_4core.json - Original failing configuration
  • configs/high_performance.json - Alternative nested format
  • configs/full_features.json - Complex configuration
  • All legacy configuration files

Performance Impact

  • Parsing Performance: No significant impact on parsing performance
  • Memory Usage: Minimal additional memory usage for enhanced parsing
  • Simulation Speed: No impact on simulation execution speed
  • Startup Time: Negligible increase in configuration loading time

Migration Guide

For Users

No migration required - this is a pure bugfix release that maintains full backward compatibility.

For Developers

If you were working around the multiprocessor configuration issue:

  1. Remove any workarounds for nested JSON parsing
  2. Update to use the standard multiprocessor configuration format
  3. Multiprocessor trace files with processor IDs are now fully supported

Verification

To verify the fix is working:

# Test the original failing command
./build/bin/cachesim --config configs/multiprocessor_4core.json traces/multiprocessor_coherence.txt

# Test with other configurations
./build/bin/cachesim --config configs/high_performance.json traces/multiprocessor_coherence.txt
./build/bin/cachesim --config configs/full_features.json traces/multiprocessor_coherence.txt

All commands should complete successfully without division by zero errors.

Acknowledgments

  • Issue Reporter: @SSFG1992 for reporting the detailed issue
  • Testing: Comprehensive testing across multiple configuration formats

Full Changelog: v1.2.0...v1.2.1